Class: Layered::Resource::Generators::ResourceGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Layered::Resource::Generators::ResourceGenerator
- Defined in:
- lib/generators/layered/resource/resource_generator.rb
Overview
Generates an app/layered_resources/<name>_resource.rb file and
appends a layered_resources :name route. Use
rails g layered:resource:scaffold for the full one-shot that also
creates the model and migration.
rails g layered:resource article title:string body:text
Instance Method Summary collapse
Instance Method Details
#add_route ⇒ Object
27 28 29 30 31 |
# File 'lib/generators/layered/resource/resource_generator.rb', line 27 def add_route return if [:skip_route] route "layered_resources :#{plural_name}" end |
#create_resource_file ⇒ Object
22 23 24 25 |
# File 'lib/generators/layered/resource/resource_generator.rb', line 22 def create_resource_file template "resource.rb.tt", File.join("app/layered_resources", "#{singular_name}_resource.rb") end |