Project

General

Profile

Actions

Defect #121

closed

Can't get to enumerations in r804

Added by Adam Knight over 16 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I try to go to /enumerations in 804 and get the following:

NoMethodError in Enumerations#index

Showing app/views/enumerations/list.rhtml where line #12 raised:

undefined method `is_default?' for #<Enumeration:0x31874fc>
Extracted source (around line #12):

9: <% enumerations.each do |enumeration| >
10: <tr class="<
= cycle('odd', 'even') >">
11: <td><
= link_to enumeration.name, :action => 'edit', :id => enumeration ></td>
12: <td style="width:15
;"><%= image_tag('true.png') if enumeration.is_default? ></td>
13: <td style="width:15
;">
14: <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id =>
enumeration, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) >
15: <
= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id =>
enumeration, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
RAILS_ROOT: script/../config/..

Application Trace | Framework Trace | Full Trace
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1857:in `method_missing'
#{RAILS_ROOT}/app/views/enumerations/list.rhtml:12:in `_run_rhtml_47app47views47enumerations47list46rhtml'
#{RAILS_ROOT}/app/views/enumerations/list.rhtml:9:in `each'
#{RAILS_ROOT}/app/views/enumerations/list.rhtml:9:in `_run_rhtml_47app47views47enumerations47list46rhtml'
#{RAILS_ROOT}/app/views/enumerations/list.rhtml:3:in `each'
#{RAILS_ROOT}/app/views/enumerations/list.rhtml:3:in `_run_rhtml_47app47views47enumerations47list46rhtml'
app/controllers/enumerations_controller.rb:24:in `index'
Request

Parameters: None

Show session dump

Response

Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}

Actions #1

Updated by Jean-Philippe Lang over 16 years ago

Migrate first and restart.

Actions #2

Updated by Adam Knight over 16 years ago

Okay, and that worked when I went from 803's DB to 804.

However, when I copy my 0.5.1 DB to a test DB and then migrate
it, the migrate fails when it's adding the enumerate column with
a similar error.


$ rake db:migrate RAILS_ENV="development" --trace

(in /Library/WebServer/redmine-test)
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
    GLoc v1.1 running in development mode. Strings can be modified
    at runtime.
  • Execute db:migrate
    AddQueriesColumnNames: migrating
    =========================================
    -- add_column(:queries, :column_names, :text)
    -> 0.0076s
    AddQueriesColumnNames: migrated (0.0077s)
    ================================
AddEnumerationsPosition: migrating
=======================================
-- add_column(:enumerations, :position, :integer, {:null=>false,
:default=>1})
-> 0.0072s
rake aborted!
undefined method `is_default?'
for #<Enumeration:0x328884c>
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/base.rb:1857:in `method_missing'
/Library/WebServer/redmine-test/config/../app/models/enumeration.
rb:47:in `before_save'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/callbacks.rb:348:in `send'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/callbacks.rb:348:in `callback'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/callbacks.rb:241:in `create_or_update'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/base.rb:1545:in `save_without_validation'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/validations.rb:752:in `save_without_transactions'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/transactions.rb:129:in `save'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/connection_adapters/abstract/database_statements.rb:59:in
`transaction'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/transactions.rb:95:in `transaction'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/transactions.rb:121:in `transaction'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/transactions.rb:129:in `save'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/validations.rb:773:in `update_attribute'
./db/migrate//072_add_enumerations_position.rb:5:in `real_up'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/base.rb:1940:in `each_with_index'
./db/migrate//072_add_enumerations_position.rb:5:in `each'
./db/migrate//072_add_enumerations_position.rb:5:in
`each_with_index'
./db/migrate//072_add_enumerations_position.rb:5:in `real_up'
./db/migrate//072_add_enumerations_position.rb:4:in `each_value'
./db/migrate//072_add_enumerations_position.rb:4:in `real_up'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:212:in `send'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:212:in `migrate'
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:212:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:335:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:330:in `each'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:330:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:297:in `up'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_
record/migration.rb:288:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases
.rake:4
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
`call'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
`execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
`execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in
`invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in
`synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in
`invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in
`each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in
`top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in
`run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
`standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in
`run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
/opt/local/bin/rake:16:in `load'
/opt/local/bin/rake:16
Actions #3

Updated by Jean-Philippe Lang over 16 years ago

You're right.
Migration 72 breaks if ran with code >= r803.

Actions #4

Updated by Jean-Philippe Lang over 16 years ago

Fix committed in r809.
Migration 72 should now run fine.

Actions #5

Updated by Adam Knight over 16 years ago

Yep, works.

Actions

Also available in: Atom PDF