Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # If I want my title attribute to be made up of several other attributes,
- # how do you make it work for new records.
- # E.g., this works for editing a record
- def title=(title)
- title = [date.year, date.month, date.day].compact.join('-') if title.blank?
- write_attribute(:title, title)
- end
- # But for a new record, the date attribute doesn't exist yet
- # and the params are (without violating MVC) inaccessible.
- # So what do you do?
Add Comment
Please, Sign In to add comment