Class: Backbonify::Generators::RouterGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Backbonify::Generators::RouterGenerator
show all
- Includes:
- ResourceHelpers
- Defined in:
- lib/generators/backbonify/router/router_generator.rb
Constant Summary
collapse
- RESERVED_JS_WORDS =
%W{
break case catch continue debugger default delete do else finally for
function if in instanceof new return switch this throw try typeof var void while with
}
Instance Method Summary
collapse
#application_name, #backbone_path, #collection_namespace, #js_app_name, #jst, #model_namespace, #plural_model_name, #router_namespace, #singular_model_name, #uncapitalize, #view_namespace
Instance Method Details
#create_router_files ⇒ Object
27
28
29
|
# File 'lib/generators/backbonify/router/router_generator.rb', line 27
def create_router_files
template 'router.js', File.join(backbone_path, "routers", class_path, "#{file_name}_router.js")
end
|
#validate_no_reserved_words ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/generators/backbonify/router/router_generator.rb', line 18
def validate_no_reserved_words
actions.each do |action|
if RESERVED_JS_WORDS.include? action
raise Thor::Error, "The name '#{action}' is reserved by javascript " <<
"Please choose an alternative action name and run this generator again."
end
end
end
|