Topic: Please help!!! controller issue?

Hi, I am new to RoR , I am trying to create a web app using  rails(3) .
I have created a new html page named mut.html.erb and placed it in view folder along with standard index, edit, show and so on templates.
I am interested in referencing  mut.html.erb, in index template so I can click on the link and go to mut.html.erb page  i've added the code in index page:


<%= link_to 'Mutation’, render 'mut.html.erb ' %> but getting an error

What is wrong? should I add something to controller?

Thank you

Re: Please help!!! controller issue?

i dont think that there is anything wrong with your controller.
try updating your link like this


<%= link_to "Mutation", "mut.html.erb " %> 

Last edited by moiseszaragoza (2012-07-13 15:08:42)

Re: Please help!!! controller issue?

hi now i am getting No route matches [GET] "/mut", any advice on how to solve this?
Thank you

Re: Please help!!! controller issue?

All your routes are defined in route.rb file> You should define them yourself like if you don't use scaffolding.
For example in your case you should have something like that:

match '/mut', to: 'your_controller_name_in_plural#mut'

it will make work the url : http://yourhost_root/mut.
If you run a scaffold on your resource, you should already have the corresponding routes defined like that:

resources :your_controller_in_plural    

In this case just add a new 'member route for mutation page like that:

resources :your_controller_in_plural do
    member do
      get :mut
    end
  end

You can always check all the available routes by running:

rake routes

in your terminal or console.
See more on routes at Rails guides: http://guides.rubyonrails.org/routing.html

Last edited by Javix (2012-07-15 15:59:27)

Re: Please help!!! controller issue?

thanks a lot !!! that worked , greatly appreciated