Fix bad rubocop auto-correct affecting procs

Switch to stabby lambdas, where consistent.

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/2136/head
Alex Coles 10 years ago
parent f98fdd7a86
commit dabd7ba88a
  1. 2
      app/models/changeset.rb
  2. 3
      app/models/project.rb
  3. 3
      lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb

@ -39,7 +39,7 @@ class Changeset < ActiveRecord::Base
description: :long_comments,
datetime: :committed_on,
url: Proc.new { |o| { controller: '/repositories', action: 'revision', id: o.repository.project, rev: o.identifier } },
author: Proc.new(&:author)
author: Proc.new { |o| o.author }
acts_as_searchable columns: 'comments',
include: { repository: :project },

@ -106,7 +106,8 @@ class Project < ActiveRecord::Base
validates_length_of :homepage, maximum: 255
validates_length_of :identifier, in: 1..IDENTIFIER_MAX_LENGTH
# downcase letters, digits, dashes but not digits only
validates_format_of :identifier, with: /\A(?!\d+$)[a-z0-9\-_]*\z/, if: Proc.new(&:identifier_changed?)
validates_format_of :identifier, with: /\A(?!\d+$)[a-z0-9\-_]*\z/,
if: -> (p) { p.identifier_changed? }
# reserved words
validates_exclusion_of :identifier, in: RESERVED_IDENTIFIERS

@ -44,7 +44,8 @@ module Redmine
dependent: :delete_all
before_validation { |customized| customized.custom_field_values if customized.new_record? }
# Trigger validation only if custom values were changed
validates_associated :custom_values, on: :update, if: Proc.new(&:custom_field_values_changed?)
validates_associated :custom_values, on: :update,
if: -> (customized) { customized.custom_field_values_changed? }
send :include, Redmine::Acts::Customizable::InstanceMethods
# Save custom values when saving the customized object
after_save :save_custom_field_values

Loading…
Cancel
Save