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
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
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
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
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?
If you’re using Rails 3, why not just do Person.where(:id => 2) ?
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
Found a solution to the problem , the default index method of the
controller should be modified to return records according to the params
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 J.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs