class LatoCore::CrudViewsGenerator

CrudViewsGenerator.

Public Instance Methods

create_crud() click to toggle source
# File lib/generators/lato_core/crud_views_generator.rb, line 14
def create_crud
  set_utils_names

  manage_views
  manage_shared_views
end

Private Instance Methods

manage_shared_views() click to toggle source
# File lib/generators/lato_core/crud_views_generator.rb, line 45
def manage_shared_views
  # copy form
  template('app/views/lato/crud/shared/_form.html.erb',
           "app/views/lato/#{@plural_name}/shared/_form.html.erb")
end
manage_views() click to toggle source
# File lib/generators/lato_core/crud_views_generator.rb, line 30
def manage_views
  # copy index
  template('app/views/lato/crud/index.html.erb',
           "app/views/lato/#{@plural_name}/index.html.erb")
  # copy show
  template('app/views/lato/crud/show.html.erb',
           "app/views/lato/#{@plural_name}/show.html.erb")
  # copy new
  template('app/views/lato/crud/new.html.erb',
           "app/views/lato/#{@plural_name}/new.html.erb")
  # copy edit
  template('app/views/lato/crud/edit.html.erb',
           "app/views/lato/#{@plural_name}/edit.html.erb")
end
set_utils_names() click to toggle source
# File lib/generators/lato_core/crud_views_generator.rb, line 23
def set_utils_names
  @model_name = model_name
  @singular_name = @model_name.underscore
  @plural_name = @singular_name.pluralize
  @controller_name = @plural_name.camelize
end