Skip to content
Snippets Groups Projects
Commit d9e646a7 authored by tiagonbotelho's avatar tiagonbotelho Committed by Yorick Peterse
Browse files

moves method to repository model

parent 85de3f69
No related branches found
No related tags found
No related merge requests found
Loading
@@ -947,12 +947,6 @@ class Project < ActiveRecord::Base
Loading
@@ -947,12 +947,6 @@ class Project < ActiveRecord::Base
end end
   
def main_language def main_language
unless empty_repo? @main_language = repository.main_language
Rails.cache.fetch([self, "language"]) do
Linguist::Repository.new(
@repository.rugged,
@repository.rugged.head.target_id).language
end
end
end end
end end
Loading
@@ -812,6 +812,18 @@ class Repository
Loading
@@ -812,6 +812,18 @@ class Repository
raw_repository.ls_files(actual_ref) raw_repository.ls_files(actual_ref)
end end
   
def main_language
return @main_language unless @main_language.nil?
unless empty?
@main_language = cache.fetch(:main_language) do
Linguist::Repository.new(
rugged,
rugged.head.target_id).language
end
end
end
private private
   
def cache def cache
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment