diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/.project.rb.swo | bin | 0 -> 49152 bytes | |||
-rw-r--r-- | app/models/project.rb | 12 |
2 files changed, 12 insertions, 0 deletions
diff --git a/app/models/.project.rb.swo b/app/models/.project.rb.swo Binary files differnew file mode 100644 index 00000000000..5d264ccfaaa --- /dev/null +++ b/app/models/.project.rb.swo diff --git a/app/models/project.rb b/app/models/project.rb index 3b565ef809a..4d2ff11cc11 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -86,6 +86,18 @@ class Project < ActiveRecord::Base end end + # checks if the language main language of the project changed + before_save :check_main_language + def check_main_language + if !repository.empty? && self.changed? + language = Linguist::Repository.new( + repository.rugged, + repository.rugged.head.target_id).language + + self.main_language = language + end + end + ActsAsTaggableOn.strict_case_match = true acts_as_taggable_on :tags |