EDIT
Here’s the project on GitHub: https://github.com/lionelrudaz/myteam2
I’m making my first application in Ruby on Rails by using the template on Railsapp (Twitter Bootstrap, Devise and CanCan).
I’ve also made the necessary steps to publish my app to Heroku.
Everything went fine so far, first publication on Heroku was alright, until I restarted the server on my MacBook Pro.
Now I get always the default error page with message “We’re sorry, but something went wrong.”
In the terminal, I get:
=> Booting Thin
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
Started GET "/" for 127.0.0.1 at 2012-10-01 19:19:21 +0200
Processing by HomeController#index as HTML
User Load (0.3ms) SELECT "users".* FROM "users"
Club Load (0.2ms) SELECT "clubs".* FROM "clubs" ORDER BY "clubs"."id" DESC LIMIT 1
Rendered home/index.html.erb within layouts/application (23.2ms)
Completed 500 Internal Server Error in 190ms
Since I don’t know how to disable the error page to get a real stack trace, I’ve started to remove lines of code by lines of code to find which line isn’t working. Actually, it looks like the f.label instructions aren’t working anymore. I know they did, I’ve used my app for a long time.
Here’s my home_controller.rb file
class HomeController < ApplicationController
def index
@users = User.all
@club = Club.last
end
end
index.html.erb
<h3>Home</h3>
<%= debug @club %>
<%= form_for @club do |f| %>
<div class="control-group">
<%= RUBY_VERSION %>
<%= Rails.version %>
<%= f.label :name, :name %>
<%= f.text_field :name %>
</div>
<% end %>
<% @users.each do |user| %>
<p>User: <%=link_to user.name, user %></p>
<% end %>
The error is fired when I change
<%= f.label :name, :name %>
to
<%= f.label :name %>
I updated my app on Heroku so you can check the debug: http://myteam2.herokuapp.com/
I don’t know what’s wrong, it’s so basic that I feel so dumb.
When I was investigating, I’ve remarked that the second argument of f.label must be a String. It’s impossible to use the t() method to change the text of the email from a i18n file.
I can’t go ahead with my application and feel really frustrated. My Google researches haven’t been successful.
Let me know if you need more information.
Cheers,
Lionel, you should seen an error message when you are running your project locally with the development environment.
I cloned your project and after a little setup I ran
rails sto start the project with the default development environment. The home page loaded fine, but clicking “Login” to go to /users/sign_in showed the following error:Error:
http://www.evernote.com/shard/s157/sh/078d0a12-73b1-4eb7-9430-55b916f19ef7/12c0cbb7b7254e5c02bb7ff0f0c4aa3f
The error indicates that a problem exists within config/locales/users.en.yml, that a Hash was expected, but none was returned.
Currently config/locales/users.en.yml is a blank file.
Fix:
You can either delete that file. Do this if you never plan on using it.
OR
add content so that parsing the file returns data in the form of a Hash. Simply add
en:to the top of config/locales/users.en.yml. Do this if you plan on entering translation data in the future.Other:
It seems like you are developing your application on Heroku. From my experience this will be difficult. It is much easier to develop locally adding features and fixing bugs. Then deploy to Heroku once your app is in a stable state. You can even set up a separate staging server on Heroku so you can test your changes before deploying to your production server.
Using the heroku gem you can run
heroku logs --tailto monitor output from your application. If you had not been using that it may have helped solve your problem.Good luck!