Ruby on Rails
Saturday, July 7, 2012
The order object is an Active Record object. You can find some comprehensive guides on Active Record here: http://guides.rubyonrails.org/
On Saturday, July 7, 2012 at 9:29 AM, Doug Jolley wrote:
I'm following through an example provided by DHH in his book, "Agile WebDevelopment with Rails". This example deals with a database with an"orders" table that has column names, "name", "email", "address" and"pay_type".The Order class is created thusly:class Order < ActiveRecord::BaseendLater the example describes one way of reading data from the rows of thetable as follows:pos = Order.find(:all, :conditions => "name = 'Dave' and pay_type ='po'")Then, the author says, "The result will be an array of all matchingrows, each neatly wrapped in an Order object."It would have been nice if he had gone on to at least describe some ofthe characteristics of this particular object. He doesn't. I have afeeling that one thing that's important for us to know about this objectis that the values for each field in the table row is contained in aninstance variable with the name of the column heading. I'm not sure ifthe raw name of the column heading is massaged in any way, i.e.,singular/plural, upper/lower case, etc. I'm also assuming that thereare accessor methods for these instance variables. What I'd like toknow is whether what I have surmised is, in fact, true. I'd also liketo know if there is anything else that I should know about this object.Can someone please fill in the blanks for me?TIA any input.... doug--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@googlegroups.com.To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment