What does the model.create! expression mean:
module StandardCreateAction
extend ActiveSupport::Concern
def create
model.create!(attributes)
render text: 'SUCCESS', status: self.class::SUCCESS_STATUS
end
end
I'm guessing it calls a same name model in the controller that uses this mixin?
In this case
modelhas nothing to do withActiveSupport::Concernwhich is just syntactic sugar around common ruby idioms such as:In this specific case
modelwould be resolved toself.modelin the class which includes or is extended by the module. Ifself.modelcannot be resolved there it goes up the class tree.I'm guessing its something along these lines:
However, you might want to to a look at ActionController::Responder and the responders gem before you go reinventing the wheel.