search for: ar_instance

Displaying 3 results from an estimated 3 matches for "ar_instance".

Did you mean: any_instance
2006 Jun 09
3
using a variable as substitute for a method
That probably isn''t the right title for this topic, but I''m not sure how else to explain in succintly. I''m sorry if this is obvious but I couldn''t find the answer in the Ruby/Rails docs. How do I use a variable as a substitute for a method/field, so that I can call the object with the variable that contains the method name. For example, say I have the
2006 Jun 09
0
Re: Rails Digest, Vol 21, Issue 195
...he object with the variable that contains the method name. Generally it''s done by obj.send(var) Method calls are just messages send to objects, so you can use the #send method to do that. In ActiveRecords''s case, there''s a special convenience method that should work: ar_instance[var] > > For example, say I have the object Product, that has methods Price, > Last_Price, Average_Price. > > I want to be able to return the value of either of those three fields > based on the user selection. Ie, user selection is stored in > params[:foo], which I assign to...
2006 Apr 28
35
what''s your rails wishlist?
I''ve been working with rails for a while now. Rails is the second web framework I''ve tried. It blows the doors off catalyst (perl''s best framework). I even just wrote my first plugin (broomstick). Ruby''s ability to meta-program blew me away with it''s ease of use. I''ve been so impressed with the helpers that rails uses to make a lot of