Hi, I see that Person.find(:all) and Person.find(:all, :params => {id => ''2''}) returns all records irrespective of conditions. Is activeresource broken? PS: Im using rails 3.2.4 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 18, 2012, at 2:45 PM, cyber c. wrote:> Hi, > > I see that > Person.find(:all) and Person.find(:all, :params => {id => ''2''}) returns > all records irrespective of conditions. Is activeresource broken? > PS: Im using rails 3.2.4---- do you actually have a column in the db named ''params'' ? That would seem to be wrong so I''m gathering that what you are actually wanting is... Person.find(:all, {:id => ''2''}) # but coming from older versions of rails, I don''t feel all that comfortable with the syntax of that and would tend to do Person.find(:all, :conditions => ["id = ?", ''2'']) Craig -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
If you''re using Rails 3, why not just do Person.where(:id => 2) ? On Monday, June 18, 2012 11:45:45 AM UTC-10, Ruby-Forum.com User wrote:> > Hi, > > I see that > Person.find(:all) and Person.find(:all, :params => {id => ''2''}) returns > all records irrespective of conditions. Is activeresource broken? > PS: Im using rails 3.2.4 > > -- > 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/XsDxi9ORjiYJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I dont have a column with "params". Person.find(:all, :conditions => [ "id = ?","9"]) generates a request Started GET "/persons.json" for 127.0.0.1 => hence returns all the records Where as Person.find(:all, {:id => ''2''}) generates a request Started GET "/persons.json?id=2" for 127.0.0.1 But *returns all the records* -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Seems like this has been a problem/bug from earlier versions. http://www.rornoob.com/a/active-resource-find-with-conditions-problem/ Is there a work around for this? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Ryan, Where is not an activeresource method. Here are the list of activeresource methods http://api.rubyonrails.org/classes/ActiveResource/Base.html Also i will be using find to look for records that match multiple conditions like if name = XYZ, build = ABC etc -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Monday, 18 June 2012 17:45:45 UTC-4, Ruby-Forum.com User wrote:> > Hi, > > I see that > Person.find(:all) and Person.find(:all, :params => {id => ''2''}) returns > all records irrespective of conditions. Is activeresource broken? > PS: Im using rails 3.2.4 > >Better question: is the service on the other end paying any attention to the parameters? Not going to have much success if it isn''t... --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HulCR5paFrUJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Found a solution to the problem , the default index methods of the controller should be modified to return records according to the params -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.