Rub classes in rails

Hello,
I am a beginner in rails and i want to create a class and access it
from the controller in rails

thanks in advance

Make a file “class_name.rb” and define your class(put it in the lib
directory)

Then in the controller use <require ‘class_name’>

Instantiate it inside your controller and off you go =D

2012/2/7 M.SH [email protected]

if you want your class wired to a database table then you would create
the class in model directory. The easiest
way to do this is to run the scaffold command which you can find in
the rails
documentation.

On Feb 7, 11:57am, Benjamin Iandavid R. [email protected]

Thank you for you replies
@Benjamin
i made what you say but doesn’t work with me
but i found that to put
require ‘file_name.rb’ in config/environment.rb and works well

Thanks for all
M.SH