On 15 Mar 2011, at 00:49, Dave Castellano <[email protected]> wrote:
> I will have hundreds of methods I need the model to call
> on depending on the situation (only one at a time), where should they
> be kept, and how to call them?
>
> I have tried...
>
> require "#{RAILS_ROOT}/lib/generators/parks_bielkowski_test.rb" in the
> model to access the test file but it does not seem to return a value.
> Is this the correct use of "require"?
>
Require just loads the file. You don't get a meaningful return value from it
> The test file contains a module
If you've defined your method in a module then in order to call that method you
need to include it in the current object (alternatively you could make it a
module method and then call SomeModule.method_name)
You might do well to do a little reading on how method lookup, modules,
inheritance etc work in ruby
Fred
>
> DC
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.