[#4177] Added Project#contracts association.
This commit is contained in:
4
init.rb
4
init.rb
@@ -24,7 +24,11 @@ end
|
||||
|
||||
require 'dispatcher'
|
||||
Dispatcher.to_prepare :redmine_contracts do
|
||||
|
||||
gem 'inherited_resources', :version => '1.0.6'
|
||||
require_dependency 'inherited_resources'
|
||||
require_dependency 'inherited_resources/base'
|
||||
|
||||
require_dependency 'project'
|
||||
Project.send(:include, RedmineContracts::Patches::ProjectPatch)
|
||||
end
|
||||
|
||||
22
lib/redmine_contracts/patches/project_patch.rb
Normal file
22
lib/redmine_contracts/patches/project_patch.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
module RedmineContracts
|
||||
module Patches
|
||||
module ProjectPatch
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
|
||||
base.send(:include, InstanceMethods)
|
||||
base.class_eval do
|
||||
unloadable
|
||||
|
||||
has_many :contracts
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
require File.dirname(__FILE__) + '/../../../../test_helper'
|
||||
|
||||
class RedmineContracts::Patches::ProjectTest < ActionController::TestCase
|
||||
|
||||
context "Project" do
|
||||
subject { Project.new }
|
||||
should_have_many :contracts
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user