Unable to integrate auditing using paper_trail gem in rails 2 application from plugin -


steps followed

  1. installed gem paper_trail 1.4.0

  2. ruby script/generate paper_trail

  3. rake db:migrate

  4. add has_paper_trail models want track of models created in plugin.

class alphenapaygrade < activerecord::base     has_paper_trail     validates_presence_of :name     validates_uniqueness_of :name end 

i getting error below:

/home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activerecord-2.3.5/lib/active_record/base.rb:1959:in `method_missing': undefined local variable or method `has_paper_trail' #<class:0x7f3beaa90f60> (nameerror) /home/rank/rails/rank_fedena/app/models/user.rb:20 /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in `load_file' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:379:in `load_file' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:259:in `require_or_load' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing' /home/rank/rails/rank_fedena/vendor/plugins/fedena_bigbluebutton/lib/fedena_bigbluebutton.rb:22 /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /home/rank/rails/rank_fedena/vendor/plugins/fedena_bigbluebutton/init.rb:17:in `evaluate_init_rb' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin.rb:158:in `evaluate_init_rb' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin.rb:154:in `evaluate_init_rb' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin.rb:48:in `load' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin/loader.rb:38:in `load_plugins' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin/loader.rb:37:in `each' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/rails/plugin/loader.rb:37:in `load_plugins' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:369:in `load_plugins' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:165:in `process' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:113:in `send' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:113:in `run' /home/rank/rails/rank_fedena/config/environment.rb:20 /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /home/rank/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/commands/server.rb:84 /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' /home/rank/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' script/server:3 

can please me integrate this? have been unable integrate last 2 days, please me out this.

add code in vendor/plugins/plugin/config/custom_environment.rb

rails::initializer.run |config|

config.gem 'paper_trail',:version => '~> 1.4.0'

end

write rake task in rake file..

namespace :plugin name desc "install module" task :install do

if file.exists?("#{rails.root}/config/environment.rb")  src = file.read("#{rails.root}/vendor/plugins/plugin/config/custom_environment.rb")  file.open("#{rails.root}/config/environment.rb", "w") |file|    file.puts(src)  end 

end end end

install plugin work fine.....


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -