How can i pass instant variable in link_to

i have this code

Listing jobs by Country

<%if @postjob !=nil %> <%for postjob in @postjob = Postjob.find(:all, :select => 'DISTINCT country')%>

<%= link_to "#{postjob.country}" , :controller => "", :action => "country_list" , :id => p%>

<%end%> <%else%> <% end %> ----------------------------------------------------------------------------------

i want to pass instant variable in link_to , can i do this ? how? i want
to display country wise posting ! help me !

Dharmdip R. wrote:

i have this code

Listing jobs by Country

<%if @postjob !=nil %> <%for postjob in @postjob = Postjob.find(:all, :select => 'DISTINCT country')%>

<%= link_to "#{postjob.country}" , :controller => "", :action => "country_list" , :id => p%>

<%end%> <%else%> <% end %> ----------------------------------------------------------------------------------

i want to pass instant variable in link_to , can i do this ? how? i want
to display country wise posting ! help me !

If I understand you right, you can simply write:
<%= link_to postjob.country, :controller => “”, :action =>
“country_list” , :id => p %>
Is variable p defined? Are you sure it is not “postjob.id”?

Indra M. wrote:

Dharmdip R. wrote:

i have this code

Listing jobs by Country

<%if @postjob !=nil %> <%for postjob in @postjob = Postjob.find(:all, :select => 'DISTINCT country')%>

<%= link_to "#{postjob.country}" , :controller => "", :action => "country_list" , :id => p%>

<%end%> <%else%> <% end %> ----------------------------------------------------------------------------------

i want to pass instant variable in link_to , can i do this ? how? i want
to display country wise posting ! help me !

If I understand you right, you can simply write:
<%= link_to postjob.country, :controller => “”, :action =>
“country_list” , :id => p %>
Is variable p defined? Are you sure it is not “postjob.id”?

It is not working properly ! i have sent u snap , if i click on
particular country , i can have all data belonging that country !
please check snap shot !

I didn’t saw this before.

Why is controller => “”?

You have to add the controller name.
If it is equal to the controller associated to the current
view’s controller, delete this parameter completely.

Indra M. wrote:

I didn’t saw this before.

Why is controller => “”?

You have to add the controller name.
If it is equal to the controller associated to the current
view’s controller, delete this parameter completely.

ok ! i understand , i have done it before , i am calling same controller
!
i have removed it . have u seen image ?

<%= link_to “#{postjob.country}” , : action =>“country_list”%>

i need help on when i click on country i want country wise listing !

n yes ! thanks for ur support !

i need help on when i click on country i want country wise listing !

n yes ! thanks for ur support !

I don’t understand your problem.

Indra M. wrote:

i need help on when i click on country i want country wise listing !

n yes ! thanks for ur support !

I don’t understand your problem.

ok ! by the way thanks