I am trying to create a simple redirect from action "other_hello" to action "index". Right now, it is redirecting to the home page when I make a GET request from the browser using the url "localhost:3000/demo/other_hello". I want it to be redirected to the index action which then renders the "demo/hello" view. My current controller looks as follows:
class DemoController < ApplicationController
layout false
def index
render('demo/hello')
end
def hello
render('demo/index')
end
def other_hello
redirect_to(:controller => 'demo', :action => 'index')
end
end
my current folder structure is the following:
[root@vc2cmmkb036933n simple_cms]# tree
.
├── app
│ ├── assets
│ │ ├── images
│ │ │ └── rails.png
│ │ ├── javascripts
│ │ │ ├── application.js
│ │ │ └── demo.js
│ │ └── stylesheets
│ │ ├── application.css
│ │ └── demo.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ └── demo_controller.rb
│ ├── helpers
│ │ ├── application_helper.rb
│ │ └── demo_helper.rb
│ ├── mailers
│ ├── models
│ └── views
│ ├── demo
│ │ ├── hello.html.erb
│ │ └── index.html.erb
│ └── layouts
│ └── application.html.erb
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── secret_token.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ └── en.yml
│ └── routes.rb
├── config.ru
├── db
│ └── seeds.rb
├── doc
│ └── README_FOR_APP
├── Gemfile
├── Gemfile.lock
├── lib
│ ├── assets
│ └── tasks
├── log
│ └── development.log
├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── demo
│ │ └── test.html
│ ├── favicon.ico
│ ├── index.html
│ └── robots.txt
├── Rakefile
├── README.rdoc
├── script
│ └── rails
├── test
│ ├── fixtures
│ ├── functional
│ │ └── demo_controller_test.rb
│ ├── integration
│ ├── performance
│ │ └── browsing_test.rb
│ ├── test_helper.rb
│ └── unit
│ └── helpers
│ └── demo_helper_test.rb
├── tmp
│ ├── cache
│ │ └── assets
│ │ ├── CF0
│ │ │ └── DA0
│ │ │ └── sprockets%2Fd7d5b37686831d37c4dd75e645f5e016
│ │ └── E25
│ │ └── 4C0
│ │ └── sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6
│ ├── pids
│ │ └── server.pid
│ ├── sessions
│ └── sockets
└── vendor
├── assets
│ ├── javascripts
│ └── stylesheets
└── plugins
47 directories, 50 files
And just to be extra careful my routes.rb file looks like:
SimpleCms::Application.routes.draw do
# get "demo/index"
root :to => "demo#index"
match ':controller(/:action(/:id))', :via => :get
end
I am currently using Ruby 1.9.3 and Rails 3.2.3.