Minor code cleanup

80 characters screen width
This commit is contained in:
jonatack 2013-12-15 18:51:48 +01:00
parent 1e24b60906
commit cb84f7f7b5
3 changed files with 8 additions and 4 deletions

View File

@ -21,8 +21,8 @@ module Ransack
end
def valid?
bound? && attr &&
context.klassify(parent).ransackable_attributes(context.auth_object).include?(attr_name)
bound? && attr && context.klassify(parent)
.ransackable_attributes(context.auth_object).include?(attr_name)
end
def type

View File

@ -5,7 +5,9 @@ module Ransack
attr_accessor :parent, :attr_name
def attr
@attr ||= ransacker ? ransacker.attr_from(self) : context.table_for(parent)[attr_name]
@attr ||= ransacker ?
ransacker.attr_from(self) :
context.table_for(parent)[attr_name]
end
alias :arel_attribute :attr

View File

@ -29,7 +29,9 @@ module Ransack
end
def name_from_attribute_name(attribute_name)
names_by_decreasing_length.detect { |p| attribute_name.to_s.match(/_#{p}$/) }
names_by_decreasing_length.detect {
|p| attribute_name.to_s.match(/_#{p}$/)
}
end
def for_attribute_name(attribute_name)