Class: ActsAsPublicable::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/acts_as_publicable/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routeObject



18
19
20
21
# File 'lib/generators/acts_as_publicable/install_generator.rb', line 18

def add_route
    route "put '/#{name.underscore.pluralize}/:id/:type' => '#{name.underscore.pluralize}#publish', :as => :publishable"
    route "acts_as_publicable :#{name.underscore.singularize}"
end

#copy_controllerObject



10
11
12
# File 'lib/generators/acts_as_publicable/install_generator.rb', line 10

def copy_controller
    template "controller.rb", "app/controllers/#{name.underscore}_controller.rb"
end

#copy_helperObject



14
15
16
# File 'lib/generators/acts_as_publicable/install_generator.rb', line 14

def copy_helper
    template "helper.rb", "app/helpers/#{name.underscore}_helper.rb"
end