Module: RestfulController::Actions::Create
- Defined in:
- lib/restful_controller/actions/create.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/restful_controller/actions/create.rb', line 4 def create model = self.class.model_class.build(model_params) instance_variable_set("@#{self.class.model_name}", model) if model.save redirect_to model, notice: "#{model.name} was successfully created." else render action: 'new' end end |