Where do you put Classes in RoR

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

#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.


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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs