Class: Merb::Generators::ResourceControllerGenerator
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
#initialize, #with_modules
Class Method Details
.source_root ⇒ Object
5
6
7
|
# File 'lib/merb-gen/resource_controller.rb', line 5
def self.source_root
File.join(super, 'resource_controller')
end
|
Instance Method Details
#controller_class_name ⇒ Object
47
48
49
|
# File 'lib/merb-gen/resource_controller.rb', line 47
def controller_class_name
chunks.last
end
|
#controller_modules ⇒ Object
43
44
45
|
# File 'lib/merb-gen/resource_controller.rb', line 43
def controller_modules
chunks[0..-2]
end
|
#file_name ⇒ Object
55
56
57
|
# File 'lib/merb-gen/resource_controller.rb', line 55
def file_name
controller_class_name.snake_case
end
|
#model_class_name ⇒ Object
59
60
61
|
# File 'lib/merb-gen/resource_controller.rb', line 59
def model_class_name
controller_class_name.singularize
end
|
#params_for_get ⇒ Object
TODO: fix this for Datamapper, so that it returns the primary keys for the model
72
73
74
|
# File 'lib/merb-gen/resource_controller.rb', line 72
def params_for_get
"params[:id]"
end
|
#plural_model ⇒ Object
63
64
65
|
# File 'lib/merb-gen/resource_controller.rb', line 63
def plural_model
controller_class_name.snake_case
end
|
#properties ⇒ Object
TODO: implement this for Datamapper so that we get the model properties
77
78
79
|
# File 'lib/merb-gen/resource_controller.rb', line 77
def properties
[]
end
|
#singular_model ⇒ Object
67
68
69
|
# File 'lib/merb-gen/resource_controller.rb', line 67
def singular_model
plural_model.singularize
end
|
#test_class_name ⇒ Object
51
52
53
|
# File 'lib/merb-gen/resource_controller.rb', line 51
def test_class_name
controller_class_name + "Test"
end
|