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 8490435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:07:06+00:00 2026-06-10T22:07:06+00:00

I am attempting to clean up my code a bit by placing my modal

  • 0

I am attempting to clean up my code a bit by placing my modal code inside of a partial, however I am encountering problems when trying to call the modal.

I tried the solution provided by How to show twitter bootstrap modal via JS request in rails?, but if I understand correctly I have to add code to a particular controller to display the modal. That would be fine however I would like to display the modal regardless of the controller/view it is in. Is this possible?

What I have (completely from the above question):

current link (views/static_pages)

<%= link_to "ModalTest", 'shared/testmodal', {:remote => true, 'data-toggle' => 'modal', 'data-target' => "testmodal" }%>

show.js.erb

$('.modal-body').html('<%= escape_javascript(render :partial => 'shared/testmodal'%>');
$('.modal-header').remove(); 

previous attempt:

<%= link_to "ModalTest", render(:partial => 'shared/testmodal') %>
  • 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-06-10T22:07:08+00:00Added an answer on June 10, 2026 at 10:07 pm

    You can include the modal contents you put in the partial, in any view you need or in your application.html, with:

    <%= render "shared/testmodal" %>
    

    And toggle it with:

    <%= link_to "ModalTest", "#testModal", "data-toggle" => "modal" %>
    

    Where #testModal is your modal id.

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

Sidebar

Related Questions

We're attempting to clean up a big bunch of brown field code, while at
I am attempting to call SQL stored procedure that does an INSERT. However, when
I am attempting to clean up some dodgy xml attributes with Regular expressions. My
I am attempting to clean out a table but not get rid of the
Consider this code attempting to create an Active Directory account. It's generating an exception
For a bit of fun, I'm attempting to write a BASIC interpreter in C#.
I'm attempting to use OpenCV (on Android) in a project, however I'm struggling to
I am attempting to keep user inputs into our application as clean as possible.
Greetings! I'm attempting to use MKMapView without any Apple code samples, though there are
I am trying to write an Internet Explorer 8 solution for loading XML through

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.