Ruby on Rails Tuesday, November 21, 2017

You can do it like below

Section.find(:all, :conditions => { :url_section => params[:ssection] } )



On Tuesday, 21 November 2017 06:16:09 UTC+5:30, Ben Edwards wrote:
I have the following code for an active record condition in a controller

  @thus_section = Section.all( :conditions => [ "url_section = ?", params[:ssection] ] )

And when I try to goto to the webpage asociated with it I get the following error:

  ArgumentError in UpcomingEventsController#index


  wrong number of arguments (given 1, expected 0)


I was using  http://guides.rubyonrails.org/active_record_querying.html to work out how to do it.


What am I doing wrong?





--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/45c64a84-8239-48de-bd3e-6090108bd1f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment