Saturday, May 22, 2010

[Rails] Re: Extending a module in a controller

Toby Rodwell wrote:
> I'm trying to extend Enumerable in my Rails app. I've started with just
> the controller where I wanted to use this method i.e.
>
> class LookupController < ApplicationController
>
> module Enumerable
> def my_compress
> ....
>
> ... but when I visit the web page in question I get "No method
> 'my_compress' for Array ..."
>
> I'm probably doing something fundamentally wrong - what could/should I
> be doing?

You should be putting your model logic in the model, not in the
controller.

>
> thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
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