Search code examples
ruby-on-railsrubyamazon-web-servicesbitnami

Does anyone know why a default rails app on the bitnami stack would refuse to allow the app root to be set?


I have just begun using rails so I apologize if this is a dumb question, but I have been googling for a few hours and I'm starting to get really frustrated.

I've set up an AWS Bitnami Rails stack using the free one on the AWS Marketplace, and I've been following the tutorial at http://guides.rubyonrails.org/getting_started.html to start getting my head around running an app functionally. (I've already done rails for zombies and ruby 101)

Basically, I get to section 4.3 which is supposed to set me up with the basic routing for the app and I can't seem to get it to work. No matter what I put in the routing file of the welcome_controller, the app just serves the template index file located at /opt/bitnami/ruby/lib/ruby/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/templates/rails/welcome/index.html.erb

My routes.rb file is

Rails.application.routes.draw do

  get 'welcome/index'

  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  root 'welcome#index'

and my welcome_controller is

    class WelcomeController < ApplicationController
  def index
  end
end

I really hope someone can help.

I'm guessing this is some sort of really stupid config error but I have a feeling others might have it as well so maybe this could be of use in the future.


Solution

  • Two possibilities:

    1. You didn't restart the rails server after you generated controller. Though, /welcome/index etc should still work without restart.
    2. Your server is running from directory which doesn't have this code checked in. As your error log doesn't reports absence of routes altogether.