Syntax error

Does my below code make sense...is it right?
<%@profile = UserPrivilege.find_all_by_user_id(4)%>

<%= options_from_collection_for_select(Profile.find(:all,:conditions =>
{:id => "#{@profile.map{|s| s.profile_id}}"},'id','name')%>

i get the below error when i run it..

Development/app/views/reports/_list.rhtml:116: syntax error, unexpected
',', expecting tASSOC
...map{|s| s.profile_id}}"},'id','name')).to_s); @output_buffer...

/Development/app/views/reports/_list.rhtml:116: syntax error, unexpected
')', expecting kEND
...ile_id}}"},'id','name')).to_s); @output_buffer.concat "\n"

Any helps

This line opens two brackets, but only closes one. Probably your problem.

Does my below code make sense...is it right?
<%@profile = UserPrivilege.find_all_by_user_id(4)%>

<%= options_from_collection_for_select(
Profile.find(:all,
             :conditions => { :id => "#{@profile.map{|s| s.profile_id}}" },
             'id',
             'name')
  %>

What are those other two arguments to find?

Does that help you see where the closing delimiter is missing? :wink:

i get the below error when i run it..

Development/app/views/reports/_list.rhtml:116: syntax error, unexpected
',', expecting tASSOC
...map{|s| s.profile_id}}"},'id','name')).to_s); @output_buffer...

/Development/app/views/reports/_list.rhtml:116: syntax error, unexpected
')', expecting kEND
...ile_id}}"},'id','name')).to_s); @output_buffer.concat "\n"

Any helps
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com