jimjohnlists-/E1597aS9LQAvxtiuMwx3w@public.gmane.org
2007-Feb-14 06:55 UTC
Need help creating a menu with Ruby Rails
Hello. I am trying to create a dynamic menu. The problem is that I am
unsure how to render ruby code in the controller class. Thanks for any
help.
Here is the standard layout
<%= link_to_remote( image_tag("graphics/
select01.gif", :alt=>''Programming'',
:size=>''100x20'', :border=>0),
:update => "select01_div",
:url =>{ :action => :select01_action }) %>
<div id="select01_div">
</div>
In the controller, when select01_action is called
def select01_action
<%= link_to image_tag("graphics/
select01a.gif", :alt=>''Programming'',
:size=>''100x20'', :border=>0), :controller
=> ''videos'', :action =>
''selectaction''%>
end
This produces the error below. I would like to render <%= link_to
image_tag("graphics/
select01a.gif", :alt=>''Programming'',
:size=>''100x20'', :border=>0), :controller
=> ''videos'', :action =>
''selectaction''%>, but how do I do that?
app/controllers/videos_controller.rb:64: syntax error
<%= link_to image_tag("graphics/
select01a.gif", :alt=>''Programming'',
:size=>''100x20'', :border=>0), :controller
=> ''videos'', :action =>
''selectaction''%>
^
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I think you want to put the link_to code in your view (.rhtml), not in your controller. If I''m wrong let me know, but that''s where I usually put mine. Andy On Feb 13, 2007, at 8:55 PM, jimjohnlists-/E1597aS9LQAvxtiuMwx3w@public.gmane.org wrote:> > Hello. I am trying to create a dynamic menu. The problem is that I am > unsure how to render ruby code in the controller class. Thanks for any > help. > > Here is the standard layout > > <%= link_to_remote( image_tag("graphics/ > select01.gif", :alt=>''Programming'', :size=>''100x20'', :border=>0), > :update => "select01_div", > :url =>{ :action => :select01_action }) %> > <div id="select01_div"> > </div> > > > In the controller, when select01_action is called > > def select01_action > <%= link_to image_tag("graphics/ > select01a.gif", :alt=>''Programming'', :size=>''100x20'', :border=>0), :co > ntroller > => ''videos'', :action => ''selectaction''%> > end > > This produces the error below. I would like to render <%= link_to > image_tag("graphics/ > select01a.gif", :alt=>''Programming'', :size=>''100x20'', :border=>0), :co > ntroller > => ''videos'', :action => ''selectaction''%>, but how do I do that? > > app/controllers/videos_controller.rb:64: syntax error > <%= link_to image_tag("graphics/ > select01a.gif", :alt=>''Programming'', :size=>''100x20'', :border=>0), :co > ntroller > => ''videos'', :action => ''selectaction''%> > ^ > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---