Linus Pettersson wrote in post #1045014:
> Well, the code in the search view is executed when the view is rendered.
> It
> is not executed again when you inject the html using javascript.
> So the if @group_trace code is only executed when the search view is
> rendered and @group_trace is not created yet.
>
>
> What are you actually trying to achieve? What do you want to do with the
> if
> @group_trace code part? Why not just remove it? You're still adding the
> data by injecting the html using javascript.

If I remove it, it throws a nil object exception which basically means
the object is empty.

I just want to click on this link in search.html.erb:

<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>


and it should load the data returned in trace_controller.rb:

def loader
@group_trace = TblTrace.find_by_sql("select top (1) * from tbl_traces
        where short_exchange_id = '" + params[:short_exchange_id]  + "'
order by created_on desc")


and display in the div in seach.html.erb here:

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

-- 
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