I’m trying without any succes to create application in which I have
one keyed table. The table structure is:
CREATE TABLE employees (
pin INTEGER PRIMARY KEY,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL
Whenever I enter new record, I need the the filed pin is also filled
by user. Whenever a user edit the table, there should be option to
edit or not edit the pin field.
After creating a database in SQL server. Editing the model:
class Employee < ActiveRecord::Base
and creating the scaffold
script/generate scaffold Employee
It simply does not work. When I try to access the
http://localhost:3000/employees/new page, I got error
undefined method `pin_before_type_cast’ for #Employee:0x4092d5d0
Extracted source (around line #5):
5: <%= text_field ‘employee’, ‘pin’ %>
8: <%= text_field ‘employee’, ‘first_name’ %>
Can anyone point me to simple example how to create controller and
view for editing simple keyed table?
Radek Hnilica http://www.hnilica.cz
No matter how far down the wrong road you’ve gone, turn back.
… so turn back … Now!