Best way to extract common methods

Modules are indeed a good way to do this. You could, as one poster suggested, throw them all into application.rb. But you might find that file getting big and unwieldy. An alternative is to group them into a well-named module or set of modules and then to include those modules in any controllers (or any other context) in which they're needed. You could put the module in a file in, say, your lib/ directory, require that file in environment.rb and then where ever it makes sense, do:

class MyController < ApplicationController   include MyWellNamedModule   def some_action     some_method_which_counts_characters_in_a_string("a string")   end end

Chad

You called the method something different from the name you're using to call it. I think you just made a simple mistake. Look closely at the definition vs. what you're calling in the controller :slight_smile:

Chad