Re: [Rails] Preventing model from saving
On 3 April 2011 19:36, John W. <lists@ruby-forum.com> wrote:
> I have a scenario where I have to prevent objects from saving to the
> database if they have a certain value and I want to come up with the
> optimal way to achieve that.
You could use a validation. That would be the normal method. Then
you can just call save and only the valid ones will actually be saved.
Colin
--
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