SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Location
    chicago, il
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing the Default Ruby Application Homepage

    Hi all,

    when I make a new ruby application, the default is the public/index.html file. Is there any way that I can change it to an index.php file or even part of my ruby application (example: mysite.com/home)? I have tried changing the public/.htaccess file like I would on a php application, but it seems to make no difference. I am currently using webrick as my development environment.

    Any suggestions?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    1. Go into config/routes.rb.
    2. Add this line before the last map.connect() line:
    Code:
    map.connect '',
        :controller => "your_controller",
        :action => "your_action"
    Replace the controllers and actions posted above with your own

  3. #3
    SitePoint Member
    Join Date
    Oct 2005
    Location
    chicago, il
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much. I haven't been able to figure that out or find any documentation on how to change that anywhere. Thanks again.

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, Webrick isn't going to be able to run PHP files as far as I'm aware though you could serve up PHP pages alongside a Rails application using lighttpd or Apache as long as it is configured properly.

    Unless you have a specific reason to do so however, I'd follow Vinnie's advice and delete index.html, replace the default route and create your own controller/action to handle the index.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Stillwater, MN
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stonhaus
    Thank you so much. I haven't been able to figure that out or find any documentation on how to change that anywhere. Thanks again.
    Interestingly enough the documentation is in the index.html file:
    Quote Originally Posted by index.html
    Trying to setup a default page for Rails using Routes? You'll have to delete this file (public/index.html) to get under way. Then define a new route in config/routes.rb of the form:
    Code:
    map.connect '', :controller => 'wiki/page', :action => 'show', :title => 'Welcome'
    It is also shown right in the routes.rb file.
    Rad Smith
    My blog

  6. #6
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stonhaus
    I have tried changing the public/.htaccess file like I would on a php application, but it seems to make no difference. I am currently using webrick as my development environment.
    webrick also doesn't use Apache .htaccess files.

    Douglas
    Hello World


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •