Ruby on Rails Monday, December 26, 2011

Monday, December 26, 2011, 4:54:22 PM, you wrote:

RS> Monday, December 26, 2011, 3:45:08 PM, you wrote:

RS>> Monday, December 26, 2011, 1:17:14 PM, you wrote:

RS>>> Referring to http://guides.rubyonrails.org/asset_pipeline.html it says:

RS>>> - - - -
RS>>> You can add additional (fully qualified) paths to the pipeline in
RS>>> config/application.rb. For example:
RS>>> config.assets.paths << Rails.root.join("app", "assets", "flash")
RS>>> - - - -

RS>>> I did that but when I look at
RS>>> Rails.application.config.assets.paths
RS>>> later in the code, the path to app/assets/flash has disappeared.

RS>>> What's the right way to add a path to assets?

RS>>> --
RS>>> Posted via http://www.ruby-forum.com/.

RS>> I'll answer my own question.

RS>> The documentation is wrong.

RS>> Instead create a file (an initializer) in config\initializers. I called mine
RS>> add_to_asset_paths.rb


RS>> My config\initializers\add_to_asset_paths.rb looks like
RS>> - - - - -
RS>> # Ralph: http://guides.rubyonrails.org/asset_pipeline.html is wrong
RS>> Rails.application.config.assets.paths << (Rails.root.join("app", "assets", "flash")).to_s
RS>> - - - - -

RS>> I hope this saves someone else from pulling their hair out.

RS> I'll add another issue to this.

RS> It appears that if the path is of the form
RS> vendor\bundle\ruby\1.9.1\gems\jw_player_helper-0.0.1\assets\javascripts

RS> (that is, the append looks like this:)

RS> Rails.application.config.assets.paths <<
RS> (Rails.root.join("app", "vendor","bundle","ruby","1.9.1","gems","jw_player_helper-0.0.1","assets", "javascripts")).to_s

RS> that the asset manager (sprockets?) won't find
RS> c:\RailsInstaller\Sites\ultradedup002\vendor\bundle\ruby\1.9.1\gems\jw_player_helper-0.0.1\assets\javascripts\swfobject.js
RS> when you do a
RS> - javascript_include_tag('swfobject.js')
RS> in your view.

Never mind. I'm probably wrong on this last point.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment