Rob Lacey wrote: > You want to do this, as its the class that needs to evaluate this > method, not the module. > > module ProjectValidations > > def self.included(base) > base.send :validates_presence_of, :project_name > end > > end
Thanks for the pointer, Rob. But I've got a lot more of these than the simple use case shows, and I'd have to modify a lot of code to modularize things that way. After some more experimentation, I've come up with this: def self.included(base) base.class_eval { validates_presence_of :project_name ... } end This way I can just cut/paste all of the validations from the original model class file into the base.class_eval block; much less mucking around. -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.