Hi all,
I have some problems inserting data into a legacy table. the key field
of this table is a field named CIN which is a varchar(15).
when I try insert into this table using a form (generated by the
scaffold generator) I get this Error :
undefined method `CIN_before_type_cast’ for #Candidat:0x370d8c8 |
|
Extracted source (around line #6): |
|
3: |
4: |
5:
CIN
|
6: <%= text_field ‘candidat’, ‘CIN’ %>
7: |
8:
Nom
|
9: <%= text_field ‘candidat’, ‘NOM_CANDIDAT’ %>
_____________________________________________________________________|
Then I added the following methods to my Model (Candidat):
|
def CIN_before_type_cast |
read_attribute(:CIN) |
end |
|
def CIN_before_type_cast=(input) |
write_attribute(:CIN, input) |
end |
_____________________________________________________________________|
when I retry to insert using the same form I get this error message :
- CIN cannot be blank
Please help, I’m a beginner and still discovering Rails and Ruby