Displaying 1 result from an estimated 1 matches for "mypart".
Did you mean:
mkpart
2005 Dec 14
4
find_by_ issue
...thods: 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:
id
partname
partnumber
vendor
I do the following:
(connection to DB already established)
class Part < ActiveRecord::Base
end
mypart = Part.find_by_partname("Large Widget")
if mypart != nil
for rs in mypart
p rs.partname
end
end
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 t...