Skip to content

Instantly share code, notes, and snippets.

@pat
Created January 9, 2015 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pat/9cdbf3c1240cdee6e9c2 to your computer and use it in GitHub Desktop.
Save pat/9cdbf3c1240cdee6e9c2 to your computer and use it in GitHub Desktop.
# Within a Reform::Form subclass, for attribute type detection with Formtastic
def column_for_attribute(attribute)
type = options_for(attribute)[:coercion_type]
Column.new type.name.demodulize.downcase.to_sym
end
Column = Struct.new :type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment