Problem with Active Query condition

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with Active Query condition

Ben Edwards
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c3564f0e-a8a8-4500-9b72-6dc913e4b1f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Active Query condition

Hassan Schroeder-2
On Mon, Nov 20, 2017 at 4:46 PM, Ben Edwards <[hidden email]> wrote:

> What am I doing wrong?

In order:

1. not having a test for the method in the first place
2. not showing us the complete code for that method
3. not showing us the full log entry and stack trace

😀
--
Hassan Schroeder ------------------------ [hidden email]
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yDRXLJDgNP24Je5rZ5H-zOA6X6TvPPWeLoU_ZYP_n0f4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Active Query condition

pratik-7
In reply to this post by Ben Edwards
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  <a href="http://guides.rubyonrails.org/active_record_querying.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_querying.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEPG8nPN8dQEWch5y1tWP24fFaF-Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2Factive_record_querying.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEPG8nPN8dQEWch5y1tWP24fFaF-Q&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Active Query condition

Ben Edwards
In reply to this post by Hassan Schroeder-2
Actualy you missed the main thisg, not saying whitch version of rails I was using.  I was using old syntax for 9I think 2.3) and was using rails 5.

On Tuesday, November 21, 2017 at 2:04:27 AM UTC, Hassan Schroeder wrote:
On Mon, Nov 20, 2017 at 4:46 PM, Ben Edwards <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="J7nHTpFKAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">lo...@...> wrote:

> What am I doing wrong?

In order:

1. not having a test for the method in the first place
2. not showing us the complete code for that method
3. not showing us the full log entry and stack trace

😀
--
Hassan Schroeder ------------------------ <a href="javascript:" target="_blank" gdf-obfuscated-mailto="J7nHTpFKAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hassan.s...@...
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d16c06ba-2a46-4956-b7a1-908e24e4e5fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.