diff --git a/app/models/polymorphic/comment.rb b/app/models/polymorphic/comment.rb index b5f279d1fd..c3355e848b 100644 --- a/app/models/polymorphic/comment.rb +++ b/app/models/polymorphic/comment.rb @@ -23,7 +23,7 @@ class Comment < ActiveRecord::Base belongs_to :user belongs_to :commentable, polymorphic: true - scope :created_by, lambda { |user| where(user_id: user.id) } + scope :created_by, ->(user) { where(user_id: user.id) } validates_presence_of :user, :commentable, :comment has_paper_trail class_name: 'Version', meta: { related: :commentable }, diff --git a/app/models/polymorphic/version.rb b/app/models/polymorphic/version.rb index 41e60ed9ad..d4aa513429 100644 --- a/app/models/polymorphic/version.rb +++ b/app/models/polymorphic/version.rb @@ -13,10 +13,10 @@ class Version < PaperTrail::Version belongs_to :related, polymorphic: true belongs_to :user, foreign_key: :whodunnit - scope :default_order, lambda { order('created_at DESC') } - scope :include_events, lambda { |*events| where(event: events) } - scope :exclude_events, lambda { |*events| where('event NOT IN (?)', events) } - scope :for, lambda { |user| where(whodunnit: user.id.to_s) } + scope :default_order, -> { order('created_at DESC') } + scope :include_events, ->(*events) { where(event: events) } + scope :exclude_events, ->(*events) { where('event NOT IN (?)', events) } + scope :for, ->(user) { where(whodunnit: user.id.to_s) } class << self def recent_for_user(user, limit = 10) diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 89046c560d..a6fd3da1ee 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -57,7 +57,7 @@ # config.collection_value_methods = [ :id, :to_s ] # How the label text should be generated altogether with the required text. - config.label_text = lambda { |label, _required, _explicit_label| "#{label}" } + config.label_text = ->(label, _required, _explicit_label) { "#{label}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil diff --git a/config/locales/th.rb b/config/locales/th.rb index 7783ec804a..2b8ce32a0b 100644 --- a/config/locales/th.rb +++ b/config/locales/th.rb @@ -41,9 +41,9 @@ module ThaiLocaleI18n date: { formats: { - default: lambda { |date, _opts| "%d-%m-#{date.year + 543}" }, + default: ->(date, _opts) { "%d-%m-#{date.year + 543}" }, short: "%d %b", - long: lambda { |date, _opts| "%d %B #{date.year + 543}" } + long: ->(date, _opts) { "%d %B #{date.year + 543}" } }, day_names: %w(อาทิตย์ จันทร์ อังคาร พุธ พฤหัสบดี ศุกร์ เสาร์), @@ -56,9 +56,9 @@ module ThaiLocaleI18n time: { formats: { - default: lambda { |date, _opts| "%a %d %b #{date.year + 543} %H:%M:%S %z" }, + default: ->(date, _opts) { "%a %d %b #{date.year + 543} %H:%M:%S %z" }, short: "%d %b %H:%M น.", - long: lambda { |date, _opts| "%d %B #{date.year + 543} %H:%M น." } + long: ->(date, _opts) { "%d %B #{date.year + 543} %H:%M น." } }, am: "ก่อนเที่ยง", pm: "หลังเที่ยง" diff --git a/lib/tasks/ffcrm/setup.rake b/lib/tasks/ffcrm/setup.rake index d9c0c8b144..73e32235c1 100644 --- a/lib/tasks/ffcrm/setup.rake +++ b/lib/tasks/ffcrm/setup.rake @@ -42,7 +42,7 @@ namespace :ffcrm do password ||= "manager" print "Password [#{password}]: " - echo = lambda { |toggle| return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") } + echo = ->(toggle) { return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") } begin echo.call(false) reply = STDIN.gets.strip