module TemplateMethods
Namespacing methods used exclusively in templates just for clarity
Public Instance Methods
form_builder_method()
click to toggle source
# File lib/generators/template_methods.rb, line 3 def form_builder_method return 'simple_form_for' if defined?(SimpleForm) 'form_for' end
plural_instance_variable()
click to toggle source
# File lib/generators/template_methods.rb, line 8 def plural_instance_variable "@#{plural_table_name}" end
singular_instance_variable()
click to toggle source
# File lib/generators/template_methods.rb, line 12 def singular_instance_variable "@#{singular_table_name}" end
table()
click to toggle source
# File lib/generators/template_methods.rb, line 16 def table ERB.new(table_partial).result binding end
table_partial()
click to toggle source
# File lib/generators/template_methods.rb, line 25 def table_partial filename = File.join(self.class.source_root, 'partials', "#{table_source}.html.erb") File.read File.expand_path(filename) end
table_source()
click to toggle source
# File lib/generators/template_methods.rb, line 20 def table_source return 'tabula_rasa_table' if defined?(TabulaRasa) 'default_table' end