Merge pull request #74 from finnlabs/feature/20043-rails-4.1

[20043] Upgrade to Rails 4.1.x
pull/6827/head
ulferts 9 years ago
commit 022585755c
  1. 2
      app/models/cost_query/custom_field_mixin.rb
  2. 2
      app/models/cost_query/filter/category_id.rb
  3. 2
      app/models/cost_query/filter/fixed_version_id.rb
  4. 6
      app/models/entry.rb
  5. 2
      lib/open_project/reporting/patches/costlog_controller_patch.rb
  6. 2
      lib/open_project/reporting/patches/timelog_controller_patch.rb
  7. 2
      openproject-reporting.gemspec
  8. 2
      spec/models/cost_query/operator_spec.rb

@ -47,7 +47,7 @@ module CostQuery::CustomFieldMixin
end end
def generate_subclasses def generate_subclasses
WorkPackageCustomField.where("field_format in ('#{SQL_TYPES.keys.join('\',\'')}')").map do |field| WorkPackageCustomField.where(field_format: SQL_TYPES.keys).map do |field|
class_name = "CustomField#{field.id}" class_name = "CustomField#{field.id}"
parent.send(:remove_const, class_name) if parent.const_defined? class_name parent.send(:remove_const, class_name) if parent.const_defined? class_name
parent.const_set class_name, Class.new(self) parent.const_set class_name, Class.new(self)

@ -27,7 +27,7 @@ class CostQuery::Filter::CategoryId < Report::Filter::Base
end end
def self.available_values(*) def self.available_values(*)
categories = Category.find :all, conditions: { project_id: Project.visible.map(&:id) } categories = Category.where(project_id: Project.visible.map(&:id))
categories.map { |c| ["#{c.project.name} - #{c.name} ", c.id] }.sort_by { |a| a.first.to_s + a.second.to_s } categories.map { |c| ["#{c.project.name} - #{c.name} ", c.id] }.sort_by { |a| a.first.to_s + a.second.to_s }
end end
end end

@ -27,7 +27,7 @@ class CostQuery::Filter::FixedVersionId < Report::Filter::Base
end end
def self.available_values(*) def self.available_values(*)
versions = Version.find :all, conditions: { project_id: Project.visible.map(&:id) } versions = Version.where(project_id: Project.visible.map(&:id))
versions.map { |a| ["#{a.project.name} - #{a.name}", a.id] }.sort_by { |a| a.first.to_s + a.second.to_s } versions.map { |a| ["#{a.project.name} - #{a.name}", a.id] }.sort_by { |a| a.first.to_s + a.second.to_s }
end end
end end

@ -53,11 +53,13 @@ module Entry
private private
def all(*args) def all(*args)
find_many :find, :all, *args ActiveSupport::Deprecation.warn('Passing arguments is deprecated') if args.any?
find_many :all # *args
end end
def count(*args) def count(*args)
find_many :count, :all, *args ActiveSupport::Deprecation.warn('Passing arguments is deprecated') if args.any?
find_many :count # *args
end end
def find_initial(options) find_one :find_initial, options end def find_initial(options) find_one :find_initial, options end

@ -53,7 +53,7 @@ module OpenProject::Reporting::Patches
if @work_package if @work_package
if @work_package.respond_to?("lft") if @work_package.respond_to?("lft")
work_package_ids = WorkPackage.all(select: :id, conditions: ["root_id = ? AND lft >= ? AND rgt <= ?", @work_package.root_id, @work_package.lft, @work_package.rgt]).collect{|i| i.id} work_package_ids = @work_package.self_and_descendants.pluck(:id)
else else
work_package_ids = [@work_package.id] work_package_ids = [@work_package.id]
end end

@ -53,7 +53,7 @@ module OpenProject::Reporting::Patches
if @issue if @issue
if @issue.respond_to?("lft") if @issue.respond_to?("lft")
work_package_ids = WorkPackage.all(select: :id, conditions: ["root_id = ? AND lft >= ? AND rgt <= ?", @issue.root_id, @issue.lft, @issue.rgt]).collect{|i| i.id.to_s} work_package_ids = @issue.self_and_descendants.pluck(:id)
else else
work_package_ids = [@issue.id.to_s] work_package_ids = [@issue.id.to_s]
end end

@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib,doc}/**/*", "README.md"] s.files = Dir["{app,config,db,lib,doc}/**/*", "README.md"]
s.test_files = Dir["spec/**/*"] s.test_files = Dir["spec/**/*"]
s.add_dependency 'rails', '~> 4.0.13' s.add_dependency 'rails', '~> 4.1.11'
s.add_dependency "reporting_engine", ">= 1.1.0" s.add_dependency "reporting_engine", ">= 1.1.0"
s.add_dependency "openproject-costs", ">= 4.0.0" s.add_dependency "openproject-costs", ">= 4.0.0"

@ -243,7 +243,7 @@ describe CostQuery, type: :model, reporting_query_helper: true do
it "does =d" do it "does =d" do
#assuming that there aren't more than one project created at the same time #assuming that there aren't more than one project created at the same time
expect(query('projects', 'created_on', '=d', Project.first(order: "id ASC").created_on).size).to eq(1) expect(query('projects', 'created_on', '=d', Project.order('id ASC').first.created_on).size).to eq(1)
end end
it "does <d" do it "does <d" do

Loading…
Cancel
Save