Rails returns a 500-error (Not sure why)
I've been trying to get Rails working, but whenever I try to create my own view, it returns a 500 error.
So, here's the steps I've followed to get where I am:
I installed Ruby to C:\Ruby
I installed Rubygems to C:\Ruby\rubygems-1.3.5 and ranruby setup.rb
In the cmd prompt, I installed rails using gem install rails
.
I created a Projects folder in C:\Ruby, and navigated to it in the cmd prompt
In the cmd prompt, I ran rails project1
开发者_Python百科, then cd project1
In the cmd prompt, I ran ruby script/generate controller home index
In the cmd prompt, I ran ruby script/server
I haven't gotten any errors at all yet.
I go to http://localhost:3000, and everything is looking good.
I navigate to http://localhost:3000/home/index, and get this:We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
I have no clue why. Is there any troubleshooting I can do?
When you create a project with rails projectname
the config-file is set to use the Active Record framework for using a database with your application. If you don't want to use a database, simply open:
\config\enviroment.rb
And set the following line:
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
to:
config.frameworks -= [ :active_record]
Restart the server with CTRL+C, and then ruby script/server
again. This should solve the problem.
As the other suggested, always have a look at \log\development.log
to find the cause of such problems. I guess youre reads something like
Status: 500 Internal Server Error
no such file to load -- sqlite3
If you want to use a database with your application, see this guide: http://guides.rubyonrails.org/getting_started.html#configuring-a-database
Take a look at your development log at log\development, and look for a line that starts with
/!\ FAILSAFE /!\
The next lines below should tell you where to look for the error. If you cannot make out the issue, post the all lines from the log file that seem related.
精彩评论