Chad Etzel
unread,Feb 1, 2011, 11:41:36 PM2/1/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SimpleRecord
Hi all,
I was playing with the simple_record (v2.0.5) gem today and created a
simple User object (extending SimpleRecord::Base) and some scaffolding
in Rails3 (w/ Ruby 1.8.7).
When calling the User.find(params[:id]) in the show method, I got the
following error:
NoMethodError in UsersController#show
private method `scan' called for 40:Fixnum
I tracked it down to the parse_condition_fields(conditions) method in
active_sdb.rb (line 632) - it seems like "conditions" is assumed to be
an Array, but in this case it was a String, and line 635 caused the
error - fields = conditions[0].scan(rx).
I changed the first conditional check from:
return nil unless conditions && conditions.present?
to:
return nil unless conditions && conditions.present? && conditions.is_a?
(Array)
and that fixed it. Otherwise, I had to call
Users.find(:first, :conditions => ["id = ?", params[:id]]) - which
seemed inelegant.
Anyway, has anyone else seen this, or am I doing something goofy and
this just happens to be a valid workaround? I'm quite new to ruby/
rails, so I could be doing something noobish...
Thanks,
-Chad