Actions
Defect #11035
openDoesn't patch "User" model in a plugin
Status:
New
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
Description
Sorry for my English :)
I have a plugin that works in "Redmine 1.3.0.stable.24228 (MySQL)"
This plugin extend a model "User". And it worked fine.
Now we have installed Redmine 2.0.0
I try rewrite my plugin, but extending model "User" call error "Expected /usr/share/srv-redmine/redmine-2.0/app/models/user.rb to define User"
This init.rb code:
Redmine::Plugin.register :advanced_roadmap do name 'Advanced Roadmap plugin' author 'Author name' description 'This is a plugin for Redmine' version '0.0.1' url 'http://example.com/path/to/plugin' author_url 'http://example.com/about' end #require 'user' ActionDispatch::Callbacks.to_prepare do User.send(:include, AdvancedRoadmap::UserPatch) end
If I add
require 'user'
I have error:
ActionView::Template::Error (undefined method `association_class' for nil:NilClass): 40: <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %> 41: <label for='q'> 42: <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>: 43: </label> 44: <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %> 45: <% end %> 46: <%= render_project_jump_box %> app/helpers/application_helper.rb:240:in `render_project_jump_box' app/views/layouts/base.html.erb:43:in `_app_views_layouts_base_html_erb___374889370_87506190' app/controllers/projects_controller.rb:168:in `show'
This's content of file "lib/advanced_roadmap/user_patch.rb"
require_dependency "user" module AdvancedRoadmap module UserPatch def self.included(base) base.extend(ClassMethods) base.send(:include, InstanceMethods) base.class_eval do end end module ClassMethods end module InstanceMethods end end end
It's my settings
root@redmine:/usr/share/srv-redmine/redmine-2.0/log# RAILS_ENV=development rake about (in /usr/share/srv-redmine/redmine-2.0) About your application's environment Ruby version 1.9.3 (i686-linux) RubyGems version 1.8.24 Rack version 1.4 Rails version 3.2.3 Active Record version 3.2.3 Action Pack version 3.2.3 Active Resource version 3.2.3 Action Mailer version 3.2.3 Active Support version 3.2.3 Middleware ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x9b232d0>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication Application root /usr/share/srv-redmine/redmine-2.0 Environment development Database adapter mysql2 Database schema version 20120422150750
Also I use: RVM (version 3.*), OS - Ubuntu 10.10
Any help is appreciated.
Actions