Sha256: 7a7c309e323903219b5459a0acfafd7783d0e4fa52b15bef54500e7a2f3fd24b

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

module RestfulController
  module Actions
    module Create
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restful-controller-0.0.3 lib/restful_controller/actions/create.rb