Where do you put Classes in RoR


#1

I’m just trying RoR and it works very smoothly. I’am also somewhat
familiar with ruby however I do not know where my Classes are supposed
to go in RoR.

E.g. my ruby file looks like

include a_few_lib_here

Class function_name
def aaaa
end
end

#main program
yadayada = function_name(parameter)

I understand:

  • the main program goes in a controller I have to create
  • but where am I suppose to put the Class stuff?

I’ll re-use the Class stuff for different controllers but I’m not sure
where it is suppposed to go. Thanks.

-T


#2

The “lib” directory is probably what you need; and don’t forget to
require your lib in environment.