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 }) %>

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’%>
^

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs