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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:05:39+00:00 2026-06-12T16:05:39+00:00

I’m very new to Rails (and web) programming, so I’m not even sure what

  • 0

I’m very new to Rails (and web) programming, so I’m not even sure what technology I should be looking for for this.

I’ve downloaded and run through the first five chapters of the Rails tutorial, but now have a very simple request.

On the left hand side of a web page, I will have a table. If the user clicks on an element in that table, I want to have the right hand side of the page show something new.

I already have a page to display the table, viz:

<div class="center hero-unit">
   <div class="container">
   <h2>2012 Yearly Report</h2>
     <div class="row-fluid">
       <div class="span12">
           <div class="span4">
            <table border="1">
            </table>
           </div>
           <div class="span6">
                <!-- load stuff here based on what someone clicks on in the table -->
           </div>
         </div>
      </div>
   </div>
</div>

And I’m using bootstrap layouts to display everything. I just don’t understand how to change the contents of the ‘span6’ div based on user behavior in ‘span4’.

  • 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-12T16:05:40+00:00Added an answer on June 12, 2026 at 4:05 pm

    This is a difficult question to answer. It really depends on what kind of data you’re trying to display and what sort of interactivity you’re looking for.

    You don’t really provide much information about what you’re trying to accomplish, but if I had to guess, you’re trying to load data from your database and insert it into an element without leaving the current page. This is what AJAX is for (your tutorial goes into it a bit in chapter 11) and involves a good deal of javascript, which is generally beyond the scope of a server side language like Ruby. Luckily, rails includes helpers for making it easy to include AJAX features into your web application without having to write a lot of javascript (although you’ll have to write some).

    As an example, suppose your table has a list of articles, and you want to display the contents of an article in a div when its link is clicked on.

    First the link:

    <%= link_to article.name, article_url(article), :remote => true %>
    

    The remote option tells Rails that it’s an AJAX link.

    Next, you need to render a javascript template for your article’s show action. You’ll name it show.js.erb.

    Supposing the div you want the data to be loaded into looks like this,

    <div id='article-content'></div>
    

    you’ll want your show.js.erb to contain the following:

    $('#article-content').html("<%=javascript_escape @article.content %>");
    

    This javascript (with embedded ruby) code will be evaluated when one of your remote links is clicked and will replace the content of your div with the article’s content.

    There is plenty of resources online to give you more information. It looks like railscasts just released an episode on this topic just a week ago. It requires a subscription to view, but is well worth it (especially if you’re just starting out).

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

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.