activerecord - When creating a new record in Rails 3 get the value of field in previous record -


i trying value of form field of previous record when creating new record.

basically each record has text area notes. when creating new record, instead of notes field containing static value or being blank, pull value of field created record.

for example parent model customer , child model called stickies.

i have tried calling:

@customer.stickies.last.notes 

when nil. assume because when calling in view assumes last record record saved. know how can accomplish this.

try using @last_note = @customer.stickies.last.notes before creating new record , use value show last note.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -