diff options
author | wycats <wycats@gmail.com> | 2010-07-14 17:33:07 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-07-14 17:33:07 -0700 |
commit | 3c300b31219f2af3ecd46ef22b04e5c5548db899 (patch) | |
tree | d42a4759e7ef4a4359061e1d38fb5209a6281384 /activerecord/lib/active_record | |
parent | 955b26ac6e729d7197f9c5134ad7d438c08293c0 (diff) | |
download | rails-3c300b31219f2af3ecd46ef22b04e5c5548db899.tar.gz rails-3c300b31219f2af3ecd46ef22b04e5c5548db899.tar.bz2 rails-3c300b31219f2af3ecd46ef22b04e5c5548db899.zip |
Style fixes
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 19ccf75b00..400a0adbcf 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1471,7 +1471,7 @@ MSG # user.send(:attributes=, { :username => 'Phusion', :is_admin => true }, false) # user.is_admin? # => true def attributes=(new_attributes, guard_protected_attributes = true) - return unless new_attributes.is_a?(Hash) + return unless new_attributes.is_a? Hash attributes = new_attributes.stringify_keys multi_parameter_attributes = [] diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 0593897fa5..4692271266 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -11,84 +11,84 @@ module ActiveRecord def includes(*args) args.reject! { |a| a.blank? } - clone.tap {|r| r.includes_values += args if args.present? } + clone.tap { |r| r.includes_values += args if args.present? } end def eager_load(*args) - clone.tap {|r| r.eager_load_values += args if args.present? } + clone.tap { |r| r.eager_load_values += args if args.present? } end def preload(*args) - clone.tap {|r| r.preload_values += args if args.present? } + clone.tap { |r| r.preload_values += args if args.present? } end def select(*args) if block_given? - to_a.select {|*block_args| yield(*block_args) } + to_a.select { |*block_args| yield(*block_args) } else - clone.tap {|r| r.select_values += args if args.present? } + clone.tap { |r| r.select_values += args if args.present? } end end def group(*args) - clone.tap {|r| r.group_values += args if args.present? } + clone.tap { |r| r.group_values += args if args.present? } end def order(*args) - clone.tap {|r| r.order_values += args if args.present? } + clone.tap { |r| r.order_values += args if args.present? } end def reorder(*args) - clone.tap {|r| r.order_values = args if args.present? } + clone.tap { |r| r.order_values = args if args.present? } end def joins(*args) args.flatten! - clone.tap {|r| r.joins_values += args if args.present? } + clone.tap { |r| r.joins_values += args if args.present? } end def where(*args) value = build_where(*args) - clone.tap {|r| r.where_values += Array.wrap(value) if value.present? } + clone.tap { |r| r.where_values += Array.wrap(value) if value.present? } end def having(*args) value = build_where(*args) - clone.tap {|r| r.having_values += Array.wrap(value) if value.present? } + clone.tap { |r| r.having_values += Array.wrap(value) if value.present? } end def limit(value = true) - clone.tap {|r| r.limit_value = value } + clone.tap { |r| r.limit_value = value } end def offset(value = true) - clone.tap {|r| r.offset_value = value } + clone.tap { |r| r.offset_value = value } end def lock(locks = true) case locks when String, TrueClass, NilClass - clone.tap {|r| r.lock_value = locks || true } + clone.tap { |r| r.lock_value = locks || true } else - clone.tap {|r| r.lock_value = false } + clone.tap { |r| r.lock_value = false } end end def readonly(value = true) - clone.tap {|r| r.readonly_value = value } + clone.tap { |r| r.readonly_value = value } end def create_with(value = true) - clone.tap {|r| r.create_with_value = value } + clone.tap { |r| r.create_with_value = value } end def from(value = true) - clone.tap {|r| r.from_value = value } + clone.tap { |r| r.from_value = value } end def extending(*modules, &block) modules << Module.new(&block) if block_given? - clone.tap {|r| r.send(:apply_modules, *modules) } + clone.tap { |r| r.send(:apply_modules, *modules) } end def reverse_order @@ -230,7 +230,7 @@ module ActiveRecord @implicit_readonly = false # TODO: fix this ugly hack, we should refactor the callers to get an ARel compatible array. # Before this change we were passing to ARel the last element only, and ARel is capable of handling an array - if selects.all? {|s| s.is_a?(String) || !s.is_a?(Arel::Expression) } && !(selects.last =~ /^COUNT\(/) + if selects.all? { |s| s.is_a?(String) || !s.is_a?(Arel::Expression) } && !(selects.last =~ /^COUNT\(/) arel.project(*selects) else arel.project(selects.last) |