Friday, January 7, 2011

[Rails] assign values to attributes.

In my model I did self.durc_expiry_date = self.durc_issue_date +
90.days but I think it is not a best practice to update attributes
from model.
So I remove that code and put
def create
@supplier = Supplier.new(params[:supplier])
@supplier.durc_expiry_date = @supplier.durc_issue_date + 90.days
.......

in the controller.
But doing so I have no values in durc.expiry.date.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate