Ruby on Rails newbie: how to get decent error reporting?
So today I've been working with RoR for the first time using the book 'Rails for PHP developers'. I'm following the tutorial i开发者_Go百科n there.
I created a project, with a model Subscriber
and a controller Subscribers
, which has a method create
. Then I ran ruby script/server
to launch Mongrel.
Now, the book says that if I go to http://localhost:3000/subscribers/create I should get an error because there's no template associated (yet) for this action. The book shows this error message:
Template missing
Missing template subscribers/create.html.erb in view path /Users/derek/work/newsletter/app/views
A nice descriptive error message, really helpful. But the error I get is:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
That error is not helpful at all. I suspect it has to do with the fact that the book uses WEBrick, and I use Mongrel. But I assume it should be possible to get more descriptive errors, right? It seems quite painful to develop with errors like this.
It looks like some of your Rails install is semi borked. You might be missing the mysql gem or might not have the mysql ActiveRecord adaptor configured correctly.
Use gem list to see the gems you have installed
$ sudo gem list
you can use the gem install command to install or update gems
$ sudo gem install rails mysql
You usually want to install gems with sudo (as root) so all users can use them ( like apache or www-data)
Im sorry your first try at Rails hasn't gone smoothly, trust me it is an extremely powerful framework. Strick with it!
You probably forgot to setup the database. You can check log/development.log for further details.
you only get the first message if you are running in development mode.
精彩评论