Hi all,

I am quite new to Rails.

The code below loads a set of data from the database. When I click on
one of the item from db, it will load more details of same item from
database and display in the <div> next to it.

See listings below to see code snippet:

listing 1(search.html.erb)
--------------------------
[code]
<div class="row">
<div class="four columns">
<nav>
<ul class="list group">
<% @tbl_unique_traces.each do |tbl_trace| %>
<li>
<a data-remote="true" href="<%= trace_loader_url (tbl_trace)
%>?short_exchange_id=<%= tbl_trace.short_exchange_id %>">
<h6>
<%=  tbl_trace.short_exchange_id %>
</h6>
<%= tbl_trace.short_exchange_id %></a></li>
</li>
<% end %>
</ul>
</nav>
</div>

<div id="loader_div" name="loader_div">
<% if @group_trace %>
<%= render(@group_trace) %>
<% end %>
</div>
</div>
[/code]


listing 2(trace_controller.rb)
------------------------------
[code]
def search
@tbl_unique_traces = TblTrace.find_by_sql("select top.....)

respond_to do |format|
format.html # show.html.erb
format.json { render :json => @tbl_unique_traces }
end
end

def loader
@group_trace = TblTrace.find_by_sql("select ........)

respond_to do |format|
format.html # loader.html.erb
format.js
format.json { render :json => @group_trace }
end
end
[/code]

listing 3(loader.js.erb)
-------------------------
[code]
$('#loader_div').html("<%=j render(@group_trace)%>");
[/code]


listing 4 (_group_trace.html.erb)
--------------------------------
[code]
<div class="eight columns">
<dl id="accordion" class="list-accordion">
<dt><span></span>view one</dt>
<dd>
<p>Data here</p>
</dd>
</dl>
</div>
[/code]

The problem is that, this codeline never get executed:

<% if @group_trace %>
<%= render(@group_trace) %>
<% end %>

And I can confirm that @group_trace has data in the trace_controller.

What can be the problem? Please help out.

Regards.

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

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to