Ruby on Rails Monday, June 27, 2011

On Mon, Jun 27, 2011 at 9:37 AM, Peter Bell <peter@pbell.com> wrote:

> I'm specifically looking to ensure that nobody on the team will write
> "user.teachers << teacher" and bypass all of the additional business
> logic in the add_teacher method.

Maybe you could instead just use the Association callbacks --

before_add, after_add, before_remove, after_remove

to run your business logic on each operation?

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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.

No comments:

Post a Comment