i am having this code for record distinct but this code is not working
???
<%for postjob in @postjob = Postjob.find(:all)%>
This Line of code is not working
<%@postjob = Postjob.find( :all, :select => ‘DISTINCT country’ )%>
####### This part is working ##########
<%= link_to
"#{postjob.country}" , :controller => "", :action => "country_list" ,
:id => p%>
<%end%>
__________________________________________________________________________________
please help !
Dharmdip R. wrote:
i am having this code for record distinct but this code is not working
???
<%for postjob in @postjob = Postjob.find(:all)%>
This Line of code is not working
<%@postjob = Postjob.find( :all, :select => ‘DISTINCT country’ )%>
####### This part is working ##########
<%= link_to
"#{postjob.country}" , :controller => "", :action => "country_list" ,
:id => p%>
<%end%>
__________________________________________________________________________________
please help !
Just go with
<%for postjob in @postjob = Postjob.find(:all, :select => ‘DISTINCT
country’) %>
ba bye
On Fri, Aug 8, 2008 at 11:02 AM, Dharmdip R. <
[email protected]> wrote:
<%for postjob in @postjob = Postjob.find(:all)%>
so at this point @postjob is an Array of your Postjobs
This Line of code is not working
<%@postjob = Postjob.find( :all, :select => ‘DISTINCT country’ )%>
and then here you’re re-assigning it something else.
####### This part is working ##########
<%= link_to
"#{postjob.country}" , :controller => "", :action => "country_list" ,
:id => p%>
Where does p used in (:id => p) come from?
Maybe you can give more details about your Model and what
exactly you would like to present using this code.
Franz
hi,
U can also do like this,
@postjob= Postjob.find_by_sql(“select distinct from postjobs”)
thanks,
shripad