Thursday, June 10, 2010

[Rails] Re: Separate validation file for each model

# file foo.rb
class Foo < ActiveRecord::Base
include FooMethods
# --- validations --- #
# --- relationships --- #
belongs_to :foobar
has_many :bars

# --- Class Methods --- #
def Foo.a_method_name(id)
...
end
end

~~~~~~~~~~~~~~~~~~~~~~~~~~~

# file foo_methods.rb

module FooMethods

def method1
...
end

def method2
...
end

end


If i will create a new module for every model to separate my validation
and logic part. Than will it help anyway in load and other things?
--
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-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