Rub classes in rails

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

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

Thank you for you replies
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