Defect #1681
closed
NoMethodError in WikiController#index
Added by A. Ni. over 16 years ago.
Updated almost 12 years ago.
Description
Called the only wikipage (startpage called "wanganui") and got this with #r1694:
undefined method `protected?' for #<WikiPage:0xb6e9d7b4>
RAILS_ROOT: /home/arnen/Documents/privat/RoR/redmine-r1694
Application Trace | Framework Trace | Full Trace
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:251:in `method_missing'
app/models/wiki_page.rb:111:in `editable_by?'
app/controllers/wiki_controller.rb:198:in `editable?'
app/controllers/wiki_controller.rb:51:in `index'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform_action_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:78:in `service'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:66
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:112:in `handle_dispatch'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:62:in `dispatch'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:251:in `method_missing'
app/models/wiki_page.rb:111:in `editable_by?'
app/controllers/wiki_controller.rb:198:in `editable?'
app/controllers/wiki_controller.rb:51:in `index'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform_action_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:112:in `handle_dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:78:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:62:in `dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:66
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
Request
Parameters:
{"id"=>"wanganui"}
Show session dump
---
:user_id: 4
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers:
{"cookie"=>[],
"Cache-Control"=>"no-cache"}
Files
that's smell that you forgot to run
rake db:migrate
on your database...
OK, updated the databases (had to use this fix though), but the error remains. Though the message is shorter:
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:251:in `method_missing'
app/models/wiki_page.rb:111:in `editable_by?'
app/controllers/wiki_controller.rb:198:in `editable?'
app/controllers/wiki_controller.rb:51:in `index'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform_action_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:112:in `handle_dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:78:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:62:in `dispatch'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:66
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/var/lib/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
Did you restart the app ?
Yes, I did restart the app. Also, I installed another webserver (lighttpd) via
ruby script/server -e production -d lighttpd
and tried to use the app with that. No change, still the error. It's a little bit odd because the wiki thing worked fine in v0.7.3 (rubygems 2.0.1) and before upgrading the database (comment
#1) and before upgrading rubygems to 2.1.
Please run the following and report the result:
$ ruby script/console production
Loading production environment (Rails 2.1.0)
>> WikiPage.column_names
=> ["id", "wiki_id", "title", "created_on", "protected"]
It looks like the column protected
is missing:
ruby script/console production
Loading production environment (Rails 2.1.0)
>> WikiPage.column_names
=> ["id", "wiki_id", "title", "created_on"]
>> quit
- Status changed from New to Closed
- Affected version (unused) deleted (
devel)
- Resolution set to Invalid
Database was not migrated. Please run the migration script on the appropriate environment, just like it's mentioned here: RedmineUpgrade.
Eg.
rake db:migrate RAILS_ENV="production"
- Status changed from Closed to Reopened
I have had this happen twice now to applications of mine, where "rake db:migrate RAILS_ENV="production" does not do as expected.
Running console I get the following output:
Loading production environment (Rails 2.1.2)
WikiPage.column_names
=> ["id", "wiki_id", "title", "created_on", "parent_id"]
However, this is after running the migrate command as mentioned at the top and with the file "093_add_wiki_pages_protected.rb" in the "db/migrate/" path.
I manually added it last time, but why is it not migrating properly?
However, if I copy 093_add_wiki_pages_protected.rb to 102_add_my_wiki_pages_protected.rb changing the class to AddMyWikiPagesProtected, it works.
It did not work if I simply copied the file and assigned it a new filename, but it did work once I changed the filename and the class name as shown, not sure if the filename required the change because I did it first.
Is there (or have you ever put) an other file in db/migrate that starts with 093_ ?
There is not currently, this is a fresh checkout (not an update) of the svn latest, however, I am using a database that I may have previously had my own 093_, when I manually added "parent_id" for wikis to 0.73 version. Is there something stored in the database that associates with the file?
- Status changed from Reopened to Closed
I have the same issue going on.
I have tried:
rake db:migrate db/migrate/093_add_wiki_pages_protected.rb RAILS_ENV="production"
and still get
Loading production environment (Rails 2.1.2)
>> WikiPage.column_names
=> ["id", "wiki_id", "title", "created_on"]
>>
which results in the following when I go to the wiki tab
Processing WikiController#index (for 216.9.187.117 at 2009-01-26 12:32:47) [GET]
Session ID: 49d5c4b1859173f00fd8f3d1cd5b106d
Parameters: {"action"=>"index", "id"=>"home", "controller"=>"wiki"}
NoMethodError (undefined method `protected?' for #<WikiPage:0x7f9a20b32b78>):
/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:251:in `method_missing'
/app/models/wiki_page.rb:112:in `editable_by?'
/app/controllers/wiki_controller.rb:209:in `editable?'
/app/controllers/wiki_controller.rb:63:in `edit'
/app/controllers/wiki_controller.rb:35:in `index'
/vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
/vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
/vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
/vendor/rails/railties/lib/fcgi_handler.rb:103:in `process_request'
/vendor/rails/railties/lib/fcgi_handler.rb:153:in `with_signal_handler'
/vendor/rails/railties/lib/fcgi_handler.rb:101:in `process_request'
/vendor/rails/railties/lib/fcgi_handler.rb:78:in `process_each_request'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each_cgi'
/vendor/rails/railties/lib/fcgi_handler.rb:77:in `process_each_request'
/vendor/rails/railties/lib/fcgi_handler.rb:76:in `catch'
/vendor/rails/railties/lib/fcgi_handler.rb:76:in `process_each_request'
/vendor/rails/railties/lib/fcgi_handler.rb:50:in `process!'
/vendor/rails/railties/lib/fcgi_handler.rb:24:in `process!'
dispatch.fcgi:24
This is the error on the web
! Picture 7.png !
This is a pretty basic installation...
Could never get it to migrate successful, so in mysql I did:
ALTER TABLE wiki_pages ADD protected VARCHAR(60);
I had other issues with the index and date sorting as well.
It gave me NoMethodError (undefined method `parent_id' for #<WikiPage:0x7f22fe6d1348>):
so I
ALTER TABLE wiki_pages ADD parent_id VARCHAR(60);
I'm using bluehost and redmine v 0.8.0 , I'm not sure why the dbmigrate is not working.
So, I ask the question again:
Is there (or have you ever put) an other file in db/migrate that starts with 093_ or 095_ ?
Hello,
I had the same problem when upgrading from v0.7.3 version to 0.8.4.
After successfully running the database migration process with :
rake db:migrate RAILS_ENV="production"
I got the following error in log/production.log when I tried to call the wiki :
NoMethodError (undefined method `protected?' for #<WikiPage:0x7f55c38a7080>):
The last migration script in v0.7.3 folder is :
$ ls db/migrate/093*
093_add_sessions.rb
Issuing the following mysql command, and restarting the app solved this issue :
mysql> ALTER TABLE wiki_pages ADD protected VARCHAR(60);
Thank you for your support,
Yann
- Status changed from Reopened to Closed
I can't confirm this in the latest releases.
Regarding the old release, this seems to be closeable.
Please reopen if this issue still hits you.
Also available in: Atom
PDF