In the Agile RoR book, page 219 (softcover version) they talk about the
fact you can use the methods: find_by_ and find_all_by_ and fill in the
last piece with a valid column name.
So I have a database table called “parts” and the following columns:
I do the following:
(connection to DB already established)
class Part < ActiveRecord::Base
mypart = Part.find_by_partname(“Large Widget”)
if mypart != nil
for rs in mypart
According to how I understand the book, I can use find_by_ and set it to
find_by_partname, however this fails with the error:
`method_missing’: undefined method
So looking at the RoR API I cannot even find the find_by_ method listed.
So now I wonder what I could be doing wrong, or did this feature get cut
after the book was published, the book’s support site doesn’t seem to
have any errata in regards to this.
Thanks for any help.