class Formtastic::InputGenerator
$ rails generate formtastic:input FlexibleText –extend string
!!!shell
@example Extend an existing input behavior
def create
def create normalize_file_name define_extension_sentence template "input.rb", "app/inputs/#{name.underscore}_input.rb" end
def define_extension_sentence
def define_extension_sentence @extension_sentence = "< Formtastic::Inputs::#{name.camelize}Input" if options[:extend] == "extend" @extension_sentence ||= "< Formtastic::Inputs::#{options[:extend].camelize}Input" if options[:extend] end
def normalize_file_name
def normalize_file_name name.chomp!("Input") if name.ends_with?("Input") name.chomp!("_input") if name.ends_with?("_input") name.chomp!("input") if name.ends_with?("input") end