Replace the default home page

How to replace the default home page. I tried map.root but it didn’t
work. I should request to please provide me ways.

Delete or rename public/index.html ?

Sijo

Hello,

First, you should delete the file public/index.html if you want another
controller to be called on your home page.
Once it’s done, you just have to add the line
map.root :controller => ‘your_controller’
(and maybe the action required if it’s not index) to your
config/routes.rb
and it’s over.
Since routes is loaded on your server startup, you’ll have to restart it
too.

Cyril

2009/7/10 Vikas [email protected]

Hello,

I’ve followed steps 1 to 5 here:
http://guides.rails.info/getting_started.html and I am getting 500 error
when trying to access http://localhost/home/index.

The standard welcome page in public worked so I assume the Mongrel is
up.

  • I deleted the welcome page;
  • Using script/generate I created home/index in app/views;
  • This is how my routes.rb looks like:

ActionController::Routing::Routes.draw do |map|
map.root :controller => “home”
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end

Result: RoR custom 500 error page. What am I doing wrong?


******* Windows Vista *********

c:\RubyProjects\project_one\public>gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.5
  • RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
  • INSTALLATION DIRECTORY: c:/Ruby/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: c:/Ruby/bin/ruby.exe
  • EXECUTABLE DIRECTORY: c:/Ruby/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-mswin32-60
  • GEM PATHS:
    • c:/Ruby/lib/ruby/gems/1.8
    • C:/Users/Victor/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

I attached the full error in development log. Looks like something wrong
with MySQL…

In addition to my previous post.

I looked into development log and there is this:

Status: 500 Internal Server Error
Access denied for user ‘root’@‘localhost’ (using password: NO)

Where is it trying to access user “root” at “localhost”?

Hi Vi Le

Assuming you gave details like username,password etc.After that
problem still exists try this from mysql konsole

GRANT ALL PRIVILEGES ON . TO [email protected] IDENTIFIED BY
‘root_password’ WITH GRANT

The above you can also setup to any other mysql user than root

Sijo

Vi Le wrote:

In addition to my previous post.

I looked into development log and there is this:

Status: 500 Internal Server Error
Access denied for user ‘root’@‘localhost’ (using password: NO)

Where is it trying to access user “root” at “localhost”?

That’s a database connection error. Check your database.yml file.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Ok, obviously this is MySQL problem. I can’t even access it via MySQL
Administrator. I get:

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using
password: YES).

I need to figure that one out first.

Thanks for pointing me in the right direction.