Refactoring the limit method
This commit is contained in:
parent
1ff7f20d66
commit
1f8a90ee9b
|
@ -87,19 +87,22 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def limit
|
||||
decimal_or_float? ? decimal_limit : column_limit
|
||||
if column
|
||||
decimal_or_float? ? decimal_limit : column_limit
|
||||
end
|
||||
end
|
||||
|
||||
def column_limit
|
||||
column && column.limit
|
||||
column.limit
|
||||
end
|
||||
|
||||
# Add one for decimal point
|
||||
def decimal_limit
|
||||
column_limit && (column_limit + 1) #for decimal point
|
||||
column_limit && (column_limit + 1)
|
||||
end
|
||||
|
||||
def decimal_or_float?
|
||||
column && column.number? && column.type != :integer
|
||||
column.number? && column.type != :integer
|
||||
end
|
||||
|
||||
def nested_boolean_style?
|
||||
|
|
Loading…
Reference in New Issue