Forum: Ruby on Rails what goes where on ruby on rails?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B072fc2897196b3bafcd337bc9c91e2d?d=identicon&s=25 Sas Sas (opensas)
on 2006-04-07 10:03
I think this subject deserves a cheat page.

Where would you put the following

1. enhacements to base classes
(like Numeric.format_integer or Time.format_shor_date)

I created files in \lib (like \lib\format.rb) and added
require "format"
in \app\controllers\application.rb

2. general helpers I want to be available to every view

I created a file in \lib (like \lib\debug_helper_module.rb), with a
module definition (like "module DebugHelper")

then in \app\helpers\application_helper.rb

require "debug_helper_modules"
# Methods added to this helper will be available to all templates in the
application.
module ApplicationHelper
  include DebugHelper
end

but it didn't work

Well, I'm just giving my first steps with ruby, but it would be great to
have a list telling where to put everything, in order to have a clean
and tidy environment.
This topic is locked and can not be replied to.