Merge pull request #1126 from wless1/master
Fixing deprecation warning for nil columns in Rails 4.2.beta1
This commit is contained in:
commit
29f8f768f1
|
@ -542,7 +542,7 @@ module SimpleForm
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_attribute_column(attribute_name)
|
def find_attribute_column(attribute_name)
|
||||||
if @object.respond_to?(:column_for_attribute)
|
if @object.respond_to?(:column_for_attribute) && @object.has_attribute?(attribute_name)
|
||||||
@object.column_for_attribute(attribute_name)
|
@object.column_for_attribute(attribute_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -130,6 +130,16 @@ class User
|
||||||
Column.new(attribute, column_type, limit)
|
Column.new(attribute, column_type, limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_attribute?(attribute)
|
||||||
|
case attribute.to_sym
|
||||||
|
when :name, :status, :password, :description, :age,
|
||||||
|
:credit_limit, :active, :born_at, :delivery_time,
|
||||||
|
:created_at, :updated_at, :lock_version, :home_picture,
|
||||||
|
:amount, :attempts, :action, :credit_card, :uuid then true
|
||||||
|
else false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.human_attribute_name(attribute, options = {})
|
def self.human_attribute_name(attribute, options = {})
|
||||||
case attribute
|
case attribute
|
||||||
when 'name'
|
when 'name'
|
||||||
|
|
Loading…
Reference in New Issue