Reputation: 49
I have an application that runs locally but does not run after deploying to heroku. On Heroku, the application defaults to the "Welcome Aboard" page. That file was removed locally.
I've been trying to resolve this issue for hours, and tried the suggestions made in other Stackoverflow answers, the most common of which is:
heroku run rake db:migrate
heroku restart
to no avail.
The issue seems to be related to the database migrations that I performed earlier. The logs show:
2013-02-10T06:58:31+00:00 app[web.1]: Processing by CorporationsController#new as HTML
2013-02-10T06:58:31+00:00 app[web.1]: Started GET "/corporations/new" for 64.236.139.254 at 2013-02-10 06:58:31 +0000
2013-02-10T06:58:31+00:00 app[web.1]: 28: <%= f.text_field :incorporation_date %>
2013-02-10T06:58:31+00:00 app[web.1]: Rendered corporations/new.html.erb within layouts/application (51.7ms)
2013-02-10T06:58:31+00:00 app[web.1]: Rendered corporations/_form.html.erb (36.4ms)
2013-02-10T06:58:31+00:00 app[web.1]: Completed 500 Internal Server Error in 60ms
2013-02-10T06:58:31+00:00 app[web.1]: 26: <div class="field">
2013-02-10T06:58:31+00:00 app[web.1]: 27: <%= f.label :incorporation_date %><br />
2013-02-10T06:58:31+00:00 app[web.1]:
2013-02-10T06:58:31+00:00 app[web.1]: ActionView::Template::Error (undefined method `incorporation_date' for #<Corporation:0x00000001e8c5c8>):
2013-02-10T06:58:31+00:00 app[web.1]: app/views/corporations/_form.html.erb:28:in `block in _app_views_corporations__form_html_erb__2627361166614576795_14624240'
2013-02-10T06:58:31+00:00 app[web.1]: 29: </div>
2013-02-10T06:58:31+00:00 app[web.1]: app/views/corporations/new.html.erb:3:in `_app_views_corporations_new_html_erb___3891731594578946395_15501200'
2013-02-10T06:58:31+00:00 app[web.1]: 30: <div class="actions">
2013-02-10T06:58:31+00:00 app[web.1]: 25: </div>
2013-02-10T06:58:31+00:00 app[web.1]:
2013-02-10T06:58:31+00:00 app[web.1]: app/views/corporations/_form.html.erb:1:in `_app_views_corporations__form_html_erb__2627361166614576795_14624240'
2013-02-10T06:58:31+00:00 app[web.1]: 31: <%= f.submit %>
2013-02-10T06:58:31+00:00 app[web.1]: app/controllers/corporations_controller.rb:34:in `new'
2013-02-10T06:58:31+00:00 app[web.1]:
I have three migration files that look like this:
20130209192118_create_corporations.rb
class CreateCorporations < ActiveRecord::Migration
def change
create_table :corporations do |t|
t.string :name
t.string :shares
t.string :par_value
t.string :incorporation_date
t.timestamps
end
end
end
20130209231940_add_filing_date_to_corporations.rb
class AddFilingDateToCorporations < ActiveRecord::Migration
def change
add_column :corporations, :filing_date, :date
end
end
20130209232108_remove_incorporation_date_from_corporations
class RemoveIncorporationDateFromCorporations < ActiveRecord::Migration
def up
remove_column :corporations, :incorporation_date
end
def down
add_column :corporations, :incorporation_date, :string
end
end
Really appreciate any thoughts...
Upvotes: 0
Views: 86
Reputation: 84
In your last migration you remove incorporation_date
column from your table, but in your corporations/_form.html.erb
you're calling f.label :incorporation_date
. It's strange that it works locally; may be you didn't run latest migrations or edited table manually.
Upvotes: 3