Rails3 - loading lib folder files

Hi All,

In my project I’m using some custom liquid tags and I have created a
folder called ‘Liquid’ inside my ‘lib’ directory and there I have a
liquid module called helpers,

module  Liquid::Helpers

end

So the project tree is as follows

Root

--> lib

      --> Liquid

And I’m trying to register my tags in my environment.rb file

Liquid::Template.register_filter(Liquid::Helpers)

To load my lib files when the server starts, I’m trying this in
application.rb

config.autoload_paths <<  File.join(Rails.root.to_s, "lib")

But I’m getting the following error

I’m on Rails3 with Ubuntu. Following is my full error code

`<top (required)>': uninitialized constant Liquid::Helpers

(NameError)
from /config.ru:3:in require' from <project path>/config.ru:3:inblock in ’
from
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in
instance_eval' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:ininitialize’
from /config.ru:1:in new' from <project path>/config.ru:1:in
from
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in
eval' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:inparse_file’
from
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:162:in
app' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:248:inwrapped_app’
from
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:213:in
start' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands/server.rb:65:instart’
from
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:30:in
block in <top (required)>' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:intap’
from
/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in
<top (required)>' from script/rails:6:inrequire’
from script/rails:6:in `’

What am i missing here, can someone help me, thanks in advance

cheers

sameera

Sameera G. wrote in post #967713:

Hi All,

In my project I’m using some custom liquid tags and I have created a
folder called ‘Liquid’ inside my ‘lib’ directory and there I have a
liquid module called helpers,

module  Liquid::Helpers

end

So the project tree is as follows

Root

--> lib

      --> Liquid

And I’m trying to register my tags in my environment.rb file

Liquid::Template.register_filter(Liquid::Helpers)

To load my lib files when the server starts, I’m trying this in
application.rb

config.autoload_paths <<  File.join(Rails.root.to_s, "lib")

But I’m getting the following error

I’m on Rails3 with Ubuntu. Following is my full error code

`<top (required)>': uninitialized constant Liquid::Helpers

[…]

Of course. Autoload expects lowercase filenames.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]