有谁知道为什么 bitnami 堆栈上的默认 rails 应用程序会拒绝设置应用程序根目录?
Does anyone know why a default rails app on the bitnami stack would refuse to allow the app root to be set?
我刚刚开始使用 rails,如果这是一个愚蠢的问题,我深表歉意,但我已经谷歌搜索了几个小时,我开始感到非常沮丧。
我已经使用 AWS Marketplace 上的免费软件设置了一个 AWS Bitnami Rails 堆栈,并且我一直在按照 http://guides.rubyonrails.org/getting_started.html 上的教程开始了解 运行 功能上的应用程序。 (我已经为僵尸完成了 rails 和 ruby 101)
基本上,我进入了第 4.3 节,该节应该为我设置应用程序的基本路由,但我似乎无法让它工作。无论我在 welcome_controller 的路由文件中放入什么,应用程序都只提供位于 /opt/bitnami/ruby/lib/ruby/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/templates/rails/welcome/index.html.erb
的模板索引文件
我的 routes.rb 文件是
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'
我的welcome_controller是
class WelcomeController < ApplicationController
def index
end
end
我真的希望有人能提供帮助。
我猜这是某种非常愚蠢的配置错误,但我感觉其他人也可能有它,所以也许这在将来会有用。
两种可能性:
- 您在生成控制器后没有重新启动 rails 服务器。不过,
/welcome/index
etc 无需重启也能正常工作。
- 您的服务器 运行 来自未签入此代码的目录。因为您的错误日志没有报告完全没有路由。
我刚刚开始使用 rails,如果这是一个愚蠢的问题,我深表歉意,但我已经谷歌搜索了几个小时,我开始感到非常沮丧。
我已经使用 AWS Marketplace 上的免费软件设置了一个 AWS Bitnami Rails 堆栈,并且我一直在按照 http://guides.rubyonrails.org/getting_started.html 上的教程开始了解 运行 功能上的应用程序。 (我已经为僵尸完成了 rails 和 ruby 101)
基本上,我进入了第 4.3 节,该节应该为我设置应用程序的基本路由,但我似乎无法让它工作。无论我在 welcome_controller 的路由文件中放入什么,应用程序都只提供位于 /opt/bitnami/ruby/lib/ruby/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/templates/rails/welcome/index.html.erb
我的 routes.rb 文件是
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'
我的welcome_controller是
class WelcomeController < ApplicationController
def index
end
end
我真的希望有人能提供帮助。
我猜这是某种非常愚蠢的配置错误,但我感觉其他人也可能有它,所以也许这在将来会有用。
两种可能性:
- 您在生成控制器后没有重新启动 rails 服务器。不过,
/welcome/index
etc 无需重启也能正常工作。 - 您的服务器 运行 来自未签入此代码的目录。因为您的错误日志没有报告完全没有路由。