Class: ApiProblemGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ApiProblemGenerator
- Defined in:
- lib/generators/api_problem/api_problem_generator.rb
Instance Method Summary collapse
Instance Method Details
#build_error_html ⇒ Object
10 11 12 13 |
# File 'lib/generators/api_problem/api_problem_generator.rb', line 10 def build_error_html template "errors_view.html.erb", "app/views#{ns_path}errors/#{name}.html.erb" template "errors_controller.erb", "app/controllers#{ns_path}errors_controller.rb" end |
#build_http_error ⇒ Object
5 6 7 8 |
# File 'lib/generators/api_problem/api_problem_generator.rb', line 5 def build_http_error template "api_problem_layout.jbuilder.erb", "app/views#{ns_path}api_problems/#{name}.jbuilder" template "api_problem_layout.xml.erb", "app/views#{ns_path}api_problems/#{name}.xml.erb" end |
#build_route ⇒ Object
15 16 17 18 |
# File 'lib/generators/api_problem/api_problem_generator.rb', line 15 def build_route route "match '#{ns_path}#{name}' => '#{ns_class_name}errors##{name}', :via => :get, :as => :#{problem}" inject_into_class "app/controllers/#{ns_path}errors_controller.rb", "#{ns_class_name}ErrorsController".classify, "def #{name}\nend\n" end |