parent
1e24b60906
commit
cb84f7f7b5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue