Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4571890
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:34:06+00:00 2026-05-21T19:34:06+00:00

How should one provide assets in an engine in Rails 3.1? Where should they

  • 0

How should one provide assets in an engine in Rails 3.1? Where should they be located and can they be included automatically?

(originally asked by Tomas Celizna)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:34:07+00:00Added an answer on May 21, 2026 at 7:34 pm

    The paths to the all the engines’ assets folders are automatically loaded.

    The assets themselves are not loaded by default. This is understandable as the loading is done with require_tree ., which loads all css/js from the current folder (i.e. the main application assets’ folder) but doesn’t say anything about the engines assets.

    The easy solution is to ask the user to require the js/css in application.js/css or wherever else it is needed. As the paths are loaded correctly, the user only need to specify the name of your asset (I’d recommend using the name of your engine). Example:

    Appended to main_app/app/assets/javascripts/application.js:

    //= require your_engine_name
    

    If you have split your js in different files, your file your_engine_name/app/assets/javascripts/your_engine_name.js could have the following:

    //= require_tree .
    

    This will load all js files in your_engine_name/app/assets/javascripts/, as the “.” refers to the local folder (in this case the folder of your engine’s javascripts).

    Note that ActionView::Helpers::AssetTagHelper.register_javascript_expansion appears not to have any effect when config.use_sprockets is set. I hope they’ll at least put a warning in that case.

    If you have a rake task to install your engine, then you could do the append to application.js.

    Another way for the user to include it is to insert <%= javascript_include_tag "your_engine_name" %> in the erb layout.

    I don’t think there is a way to have it inserted automatically

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

They both provide roughly the same functionality. Which one should I choose to develop
All examples in Qt show that one should use delegate classes to provide editors
Can any one provide me an idea about any ajax control which has following
can any body tell me how one should activate Osgi console in web.xml when
Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing
How should one ensure correctness when multiple processes access one single SQLite database file?
How should one split up the controllers in an ASP.NET MVC site? For example,
Why should one go for Windows Installer XML (WiX) when we have in built
When should one use the f:viewAction or preRenderView event to initialize data for a
Question Should one discard a packet with an unknown IPv6 extension header? Details I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.