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

  • SEARCH
  • Home
  • 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 1021111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:15:44+00:00 2026-05-16T11:15:44+00:00

I am writing a gem which provides helpers for views. The HTML I want

  • 0

I am writing a gem which provides helpers for views. The HTML I want to insert via the helper is complex enough that I’d rather write it in a _partial.html.erb file. How do I get the gem’s view path include in the application’s load_path?

Note: the only gem I’ve found that does something like this is Devise. When a view cannot be found, Rails prints the load path which (on my machine) looks like:

Missing partial sortable_nested_set/tree with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/jason/VirtualRestaurant3/app/views", "/home/jason/.rvm/gems/ruby-1.9.2-preview3/gems/devise-1.1.rc0/app/views"

How does Devise do it?

My gem: http://github.com/jrmurad/SortableNestedSet
Devise gem: +http://+github.com/plataformatec/devise

  • 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-16T11:15:45+00:00Added an answer on May 16, 2026 at 11:15 am

    If you put the ‘app’ directory in the base directory of your plugin, Rails will add app/views to the view path by default.

    .
    ├── app
    │   └── views
    │       └── plugin_name
    │           └── _my_partial.html.erb
    

    Then you can render the partial from your plugin’s helper method with:

    render :partial => "plugin_name/my_partial"
    

    Note that Rails doesn’t make the views available by default in the plugin test environment. To Include them there add the following to test/test_helper.rb:

    ActionController::Base.prepend_view_path File.dirname(__FILE__) + "/../app/views"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a gem that I want to extend a model. I tried defining
I am writing a reporting gem that will have some helpers to extract data
Writing documentation in html requires some code examples. What to do with characters that
I am writing my first Rails gem, which adds a method to ActiveRecord. I
I am writing a db logging ruby gem which will simply take out a
I am writing a gem that requires rails as a dependency (for using Rails
I'm writing a library that depend on a specific gem. I require the gem
I'm writing a spec for a form page which uses DragonFly gem to handle
I'm writing a gem, that includes a C extension. Usually when I write a
I'm writing my own ruby gem and I have to use the url_for ActionView

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.