rails2.0でredmineを動かすときにはまったこと

環境

About your application's environment
Ruby version              1.8.6 (amd64-freebsd6)
RubyGems version          0.9.4
Rails version             2.0.2
Active Record version     2.0.2
Action Pack version       2.0.2
Active Resource version   2.0.2
Action Mailer version     2.0.2
Active Support version    2.0.2
Edge Rails revision       2
  • (acts_as_tree missing)

エラーログ

[ERROR:1]% mongrel_rails start -p 3300 -e production                                                 [/home/utadaq/www/redmine] ** Starting Mongrel listening at 0.0.0.0:3300
** Starting Rails with production environment...
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in `method_missing': undefined method `acts_as_tree' for #<Class:0x2da7260> (NoMethodError)
        from /home/utadaq/www/redmine/app/models/message.rb:21
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:104:in `require_or_load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant'
         ... 28 levels...
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/command.rb:212:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:281
        from /usr/local/bin/mongrel_rails:16:in `load'
        from /usr/local/bin/mongrel_rails:16

rails2.0では、act_as_treeはプラグインになったからインストールが必要だよ

[ERROR:1]% ./script/plugin install acts_as_tree                                                                  [/home/utadaq/www/redmine]
+ ./README
+ ./Rakefile
+ ./init.rb
+ ./lib/active_record/acts/tree.rb
+ ./test/abstract_unit.rb
+ ./test/acts_as_tree_test.rb
+ ./test/database.yml
+ ./test/fixtures/mixin.rb
+ ./test/fixtures/mixins.yml
+ ./test/schema.rb
[6531]% mongrel_rails start -p 3300 -e production                                                                [/home/utadaq/www/redmine]
** Starting Mongrel listening at 0.0.0.0:3300
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.3 available at 0.0.0.0:3300
** Use CTRL-C to stop.

参考

http://railsforum.com/viewtopic.php?pid=46385

Re: undefined method `acts_as_tree' for #<Class:0xb7b15758>

as of the rails2 ,the acts_as_tree not built in the rails by default, if you need the method, you need install it as plugin
./script/plugin install acts_as_tree

次のエラーです。

producition.logにこんなのが吐き出されました。

 A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } in config/environment.rb

言われたとおりに、config/environment.rbに

config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } 

追加してみた。

とりあえず画面表示されるとこまではたどり着けました。