Class: RedBase::Generators::JsScaffoldGenerator::Relation
- Inherits:
-
String
- Object
- String
- RedBase::Generators::JsScaffoldGenerator::Relation
- Defined in:
- lib/generators/red_base/js_scaffold_generator.rb
Instance Attribute Summary collapse
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #get_list ⇒ Object
-
#initialize(value, to_) ⇒ Relation
constructor
A new instance of Relation.
- #resource_name ⇒ Object
- #restangular ⇒ Object
Constructor Details
#initialize(value, to_) ⇒ Relation
Returns a new instance of Relation.
210 211 212 213 |
# File 'lib/generators/red_base/js_scaffold_generator.rb', line 210 def initialize(value, to_) super(value) self.to = to_ end |
Instance Attribute Details
#to ⇒ Object
Returns the value of attribute to.
208 209 210 |
# File 'lib/generators/red_base/js_scaffold_generator.rb', line 208 def to @to end |
Instance Method Details
#get_list ⇒ Object
227 228 229 |
# File 'lib/generators/red_base/js_scaffold_generator.rb', line 227 def get_list "#{restangular}.getList()" end |
#resource_name ⇒ Object
215 216 217 |
# File 'lib/generators/red_base/js_scaffold_generator.rb', line 215 def resource_name to.split("/").last end |
#restangular ⇒ Object
219 220 221 222 223 224 225 |
# File 'lib/generators/red_base/js_scaffold_generator.rb', line 219 def restangular result = "API" to.split("/").each do |resource| result = "#{result}.all(\"#{resource}\")" end result end |