Module: ApiLogic
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/api_logic.rb,
lib/api_logic/responder.rb
Defined Under Namespace
Modules: ClassMethods
Classes: Responder
Instance Method Summary
collapse
Instance Method Details
#create_attributes ⇒ Object
103
104
105
|
# File 'lib/api_logic.rb', line 103
def create_attributes
model_params
end
|
#create_model ⇒ Object
98
99
100
|
# File 'lib/api_logic.rb', line 98
def create_model
model_class.create(create_attributes)
end
|
#find_model ⇒ Object
93
94
95
96
|
# File 'lib/api_logic.rb', line 93
def find_model
@model = model_class.find(params[:id])
instance_variable_set "@#{model_singular}", @model
end
|
#find_models ⇒ Object
89
90
91
|
# File 'lib/api_logic.rb', line 89
def find_models
model_class.all
end
|
#model_class ⇒ Object
116
117
118
|
# File 'lib/api_logic.rb', line 116
def model_class
self.class.model
end
|
#model_collection ⇒ Object
120
121
122
|
# File 'lib/api_logic.rb', line 120
def model_collection
self.class.model_collection
end
|
#model_params ⇒ Object
111
112
113
|
# File 'lib/api_logic.rb', line 111
def model_params
params[model_singular]
end
|
#model_singular ⇒ Object
124
125
126
|
# File 'lib/api_logic.rb', line 124
def model_singular
self.class.model_singular
end
|
#update_attributes ⇒ Object
107
108
109
|
# File 'lib/api_logic.rb', line 107
def update_attributes
model_params
end
|