Rachela Meadows
Rachela Meadows

Reputation: 815

How to a set a variable for a rails gem?

Hello I want to set the following:

AssetHash::Base.asset_paths = ['assets']

as seen here: https://github.com/donaldpiret/asset_hash

I added it to an initializer, to environment.rb but it never takes effect. Here's the actually gem source for this: https://github.com/donaldpiret/asset_hash/blob/master/lib/asset_hash.rb

Can you please help me understand where I can set this config option?

Thanks

Upvotes: 1

Views: 72

Answers (1)

apneadiving
apneadiving

Reputation: 115531

Your solution is good, weird it doesn't work.

Another one is to override the self.asset_paths method since it is supposed to provide the proper paths.

In an initializer:

 AssetHash::Base.class_eval do
   def self.assets_path
      your_array_here
   end
 end

Upvotes: 1

Related Questions