I''m getting:
undefined method `Find_by_pnumber'' for Student:Class
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:799:in
`method_missing''
despite (I''m forever forgetting the semicolon!):
mysql> describe students
-> ;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| id | int(14) unsigned | | PRI | NULL | auto_increment |
[...]
| pnumber | varchar(40) | | UNI | | |
| lock_version | int(11) | YES | | 0 | |
+--------------+------------------+------+-----+---------+----------------+
8 rows in set (0.01 sec)
According to page 218-9 of the book that method should just spring
into being, but I can''t find what the prerequisites of this
happening are really. "find_by_sql" is in the index, but
"find_by<i>_something</i>" is not. So, what do I need to
do to my
model(s) to get this working, please?
Thank you,
Hugh