Created
September 11, 2013 01:40
-
-
Save nauman/6518355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Basefields | |
def default_fields label | |
case label | |
when "name" then "text_field" | |
when "password" then "password_field" | |
when "hidden" then "hidden_field" | |
when "message" , "description" then "text_area" | |
#when "position" then "number_field" | |
when "email" then "email_field" | |
else sql_type_fields label | |
end | |
end | |
def sql_type_fields label | |
label_type = self.class.column_types[label].type | |
case label_type | |
when :integer then "number_field" | |
when :text then "text_area" | |
when :string then "text_field" | |
when :boolean then "check_box" | |
else "text_field" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment