Railsに自作libの追加方法
Railsに自作libの追加方法
config/application.rbに追記
・・・ module アプリ名 class Application < Rails::Application config.autoload_paths += %W(#{config.root}/lib) end end ・・・
lib/foo_hoge.rb
class FooHoge def test pust "test" end end
実行方法
FooHoge.new.test
lib/foo/hoge.rb
module Foo class Hoge def test pust "test" end end end
実行方法
Foo::Hoge.new.test