Class: Rdcms::Generators::ArticletypeGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Rdcms::Generators::ArticletypeGenerator
- Defined in:
- lib/generators/rdcms/articletype/articletype_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_articletype_files ⇒ Object
7 8 9 |
# File 'lib/generators/rdcms/articletype/articletype_generator.rb', line 7 def create_articletype_files generate("model", "#{name} #{model_attributes.join(' ')} article_id:integer") end |
#create_partials ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/generators/rdcms/articletype/articletype_generator.rb', line 11 def create_partials copy_file 'index.html.erb', "app/views/articletypes/#{name.underscore}/_index.html.erb" copy_file 'show.html.erb', "app/views/articletypes/#{name.underscore}/_show.html.erb" template 'edit_show.html.erb', "app/views/articletypes/#{name.underscore}/_edit_show.html.erb" copy_file 'edit_index.html.erb', "app/views/articletypes/#{name.underscore}/_edit_index.html.erb" template 'initializer.rb', "config/initializers/rdcms_#{name.underscore}.rb" end |
#updates_model ⇒ Object
19 20 21 22 23 |
# File 'lib/generators/rdcms/articletype/articletype_generator.rb', line 19 def updates_model inject_into_class "app/models/#{name.underscore}.rb", name.constantize do "belongs_to :article , :class_name => Article\nSortOptions = []\ndef fulltext_searchable_text\n''\nend\n" end end |