A better approach would be to wrap your pseudo-module in a class and add validations there. In Rails mode, it is indicated that you should not put model behavior on controllers, the only checks should be those that go with the request itself (authentication, authorization, etc.).
In Rails 2.3+, you can enable ActiveRecord::Validations , with the slight drawback that you must define some methods that the ActiveRecord layer expects. See this post for a deeper explanation. Below is the code below:
require 'active_record/validations' class Email attr_accessor :name, :email attr_accessor :errors def initialize(*args)
In Rails3, you have those sexual checks at your disposal :)
Chubas
source share