Sha256: de418e388c2966c2f64a8e2ffbaa4d5b00200aa45f61dafb05101263b8934ed4
Contents?: true
Size: 742 Bytes
Versions: 4
Compression:
Stored size: 742 Bytes
Contents
module Para class TableGenerator < Para::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) desc 'Para resources table generator' def generate_table template( "_table.html.haml", "app/views/admin/#{ plural_namespaced_path }/_table.haml" ) end private def attributes @attributes ||= begin model = begin Para.const_get(class_name) rescue class_name.classify.constantize end AttributeFieldMappings.new(model).fields end end def attributes_list @attributes_list ||= attributes.map do |field| field.name.to_sym.inspect end.join(', ') end end end
Version data entries
4 entries across 4 versions & 1 rubygems