For your case, use:
if @premail.save
redirect_to :action => :about
end
else
is not needed here, since by default Rails would render app/views/pages/home.html.erb
, be sure you have this file.
Also when you redirect to about
, you will need app/views/pages/about.html.erb
file to be present.
Update
Seems you don't have this route in config/routes.rb
, for Rails 3.x:
match ':controller(/:action(/:id))'
In Rails 4:
match ':controller(/:action(/:id))', :via => [:get , :post]
If you are planning to just answer to get, i.e. there are nor forms posting to controllers:
get ':controller(/:action(/:id))'
This will detect routes like localhost:3000/asd/qwe/1
and:
- Use
asd
as controllerAsdController
Use
qwe
as action:class AsdController def qwe; end
params[:id]
would be equal to 1.()
means optional, for example if you go in your browser tolocalhost:3000/asd
, Rails would callAsd#index
, i.e.:class AsdController def index # whatever you have here end