Hi, I attached a page for clarity of what I want. I have a two column page (index.html.erb). On the left hand side, I have the order ID and order NAME displayed. There is a SHOW link next to each entry. I want to be able to click on the SHOW link and have it display the full order information on the right hand column (this is the show.html.erb file that Rails generated). I turned the default Rails generated show.html.erb file into a partial. I''m sure this has to use link_to_remote on the SHOW link, but I''m not sure how to make it update the right hand column with the partial. I''ve read through a lot of the Rails API info jumping around to Helpers, remote_function and other things. I''m sure I''m missing something simple. Any help would be appreciated. Attachments: http://www.ruby-forum.com/attachment/4746/ScreenShot003.jpg -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Okay, I made a really dumb mistake and put: <% javascript_include_tag ''defaults'' %> Instead of: <% javascript_include_tag :defaults %> So that fixed my rendering. At least I''m getting information over to the other column now. But it''s an error, because it can''t find the ID. I attached the screenshot of the error I''m seeing. The following will be the code I currently have pertaining to this function. If anyone has any ideas on why it''s throwing that error, I would really appreciate it (I know I''m missing something small here). Here is my Show action in the Controller: def show @order = Order.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @order } end end ---- Here''s the sections I have in my index.html.erb file: <% @orders.each do |order| %> <tr> <td><%=h order.id %></td> <td><%=h order.name %></td> <td><%= link_to_remote "Show", :url => {:controller => ''orders'', :action => ''show''}, :update => "order_div", :method => ''get'' %></td> </tr> <% end %> -- <div id="order_div"> </div> ---- Here is the info in the _order_show.html.erb partial: <p> <b>Name:</b> <%=h @order.name %> </p> <p> <b>Address:</b> <%=h @order.address %> </p> <p> <b>City:</b> <%=h @order.city %> </p> <p> <b>State:</b> <%=h @order.state %> </p> <p> <b>Zip:</b> <%=h @order.zip %> </p> .....ETC Attachments: http://www.ruby-forum.com/attachment/4747/ScreenShot004.jpg -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 20, 2010, at 5:01 PM, Matt Royer wrote:> Okay, I made a really dumb mistake and put: > > <% javascript_include_tag ''defaults'' %> > > Instead of: > > <% javascript_include_tag :defaults %> > > So that fixed my rendering. At least I''m getting information over to > the > other column now. But it''s an error, because it can''t find the ID. I > attached the screenshot of the error I''m seeing. The following will be > the code I currently have pertaining to this function. If anyone has > any > ideas on why it''s throwing that error, I would really appreciate it (I > know I''m missing something small here). > > Here is my Show action in the Controller: > > def show > @order = Order.find(params[:id]) > > respond_to do |format| > format.html # show.html.erb > format.xml { render :xml => @order } > > end > end > > ---- > > Here''s the sections I have in my index.html.erb file: > > <% @orders.each do |order| %> > <tr> > <td><%=h order.id %></td> > <td><%=h order.name %></td> > <td><%= link_to_remote "Show", :url => {:controller => > ''orders'', :action => ''show'',:id => order.id> }, :update => "order_div", :method => ''get'' > %></td> > </tr> > <% end %> > > -- > > <div id="order_div"> > > </div> > > ---- > > Here is the info in the _order_show.html.erb partial: > > <p> > <b>Name:</b> > <%=h @order.name %> > </p> > > <p> > <b>Address:</b> > <%=h @order.address %> > </p> > > <p> > <b>City:</b> > <%=h @order.city %> > </p> > > <p> > <b>State:</b> > <%=h @order.state %> > </p> > > <p> > <b>Zip:</b> > <%=h @order.zip %> > </p> > > .....ETC > > Attachments: > http://www.ruby-forum.com/attachment/4747/ScreenShot004.jpg >But you could also use a named route for the url. Something like order_path(order) -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org http://gaslightsoftware.com rab-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rob Biedenharn wrote: Hi Rob, Thanks for the quick response! I''m sorry, I''m still relatively new at this Rails stuff. I have gone through a couple of books, but it''s hard to tie it all together. :) When you put the following:> :id => order.idWhere should I enter that? Within the link_to_remote somewhere? Also, I would like to know the following. Not sure where I would enter that path in the link_to_remote:> But you could also use a named route for the url. Something like > order_path(order)Thanks again! I need all the help I can get. :) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 20, 2010, at 5:45 PM, Matt Royer wrote:> Rob Biedenharn wrote: > > Hi Rob, > > Thanks for the quick response! > > I''m sorry, I''m still relatively new at this Rails stuff. I have gone > through a couple of books, but it''s hard to tie it all together. :) > > When you put the following: > >> :id => order.id > > Where should I enter that? Within the link_to_remote somewhere?Yes, right where I put it:> <td><%= link_to_remote "Show", :url => {:controller => > ''orders'', :action => ''show'',:id => order.id> }, :update => "order_div", :method => ''get'' > %></td>> Also, I would like to know the following. Not sure where I would enter > that path in the link_to_remote: > >> But you could also use a named route for the url. Something like >> order_path(order) > > Thanks again! I need all the help I can get. :)<td><%= link_to_remote("Show", :url => order_path(order), :update => "order_div", :method => ''get'') %></td> -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org http://gaslightsoftware.com rab-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Rob!!! It worked PERFECTLY. Thanks again for you help! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.