diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-15 14:23:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-15 14:23:06 +0000 |
commit | fb1a2fd7cd4ca7335d660265a32604f6e2006dd6 (patch) | |
tree | 444bf09c5a63e91cc314de7c7e9fd78f93d1ff09 /app/models/repository.rb | |
parent | 6f462d373f1b57657082f22f882942d41df47a39 (diff) | |
download | redmine-fb1a2fd7cd4ca7335d660265a32604f6e2006dd6.tar.gz redmine-fb1a2fd7cd4ca7335d660265a32604f6e2006dd6.zip |
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8648 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 5130cc220..c231a8724 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -48,6 +48,26 @@ class Repository < ActiveRecord::Base super(attr_name, *args) end + alias :attributes_without_extra_info= :attributes= + def attributes=(new_attributes, guard_protected_attributes = true) + return if new_attributes.nil? + attributes = new_attributes.dup + attributes.stringify_keys! + + p = {} + p_extra = {} + attributes.each do |k, v| + if k =~ /^extra_/ + p_extra[k] = v + else + p[k] = v + end + end + + send :attributes_without_extra_info=, p, guard_protected_attributes + merge_extra_info(p_extra) + end + # Removes leading and trailing whitespace def url=(arg) write_attribute(:url, arg ? arg.to_s.strip : nil) |