lib/clevic/field.rb in clevic-0.13.0.b6 vs lib/clevic/field.rb in clevic-0.13.0.b9
- old
+ new
@@ -316,11 +316,11 @@
meta.andand.association?
end
# Clevic::ModelColumn object
def meta
- entity_class.meta[attribute]
+ entity_class.meta[attribute] || ModelColumn.new( attribute, {} )
end
# return true if this field can be used in a filter
# virtual fields (ie those that don't exist in this field's
# table) can't be used to filter on.
@@ -485,30 +485,30 @@
end
# sensible display format defaults if they're not defined.
def default_format!
@format ||=
- case meta.type
+ case meta.andand.type
when :time; '%H:%M'
when :date; '%d-%h-%y'
when :datetime; '%d-%h-%y %H:%M:%S'
when :decimal, :float; "%.2f"
end
end
# sensible edit format defaults if they're not defined.
def default_edit_format!
@edit_format ||=
- case meta.type
+ case meta.andand.type
when :date; '%d-%h-%Y'
when :datetime; '%d-%h-%Y %H:%M:%S'
end || default_format!
end
# sensible alignment defaults if they're not defined.
def default_alignment!
@alignment ||=
- case meta.type
+ case meta.andand.type
when :decimal, :integer, :float; :right
when :boolean; :centre
else :left
end
end