Class: DynamicController::Responder
- Inherits:
-
Object
- Object
- DynamicController::Responder
- Defined in:
- lib/dynamic_controller/responder.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
-
#initialize(controller) ⇒ Responder
constructor
A new instance of Responder.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(controller) ⇒ Responder
Returns a new instance of Responder.
4 5 6 |
# File 'lib/dynamic_controller/responder.rb', line 4 def initialize(controller) @controller = controller end |
Instance Method Details
#create ⇒ Object
30 31 32 33 34 |
# File 'lib/dynamic_controller/responder.rb', line 30 def create action :create, html: Proc.new { redirect_to action: :show, id: model.id }, json: Proc.new { render json: model, status: :created } end |
#destroy ⇒ Object
42 43 44 45 46 |
# File 'lib/dynamic_controller/responder.rb', line 42 def destroy action :destroy, html: Proc.new { redirect_to action: :index }, json: Proc.new { head :no_content } end |
#edit ⇒ Object
25 26 27 28 |
# File 'lib/dynamic_controller/responder.rb', line 25 def edit action :edit, html: Proc.new {} end |
#index ⇒ Object
8 9 10 11 12 |
# File 'lib/dynamic_controller/responder.rb', line 8 def index action :index, html: Proc.new {}, json: Proc.new { render json: collection } end |
#new ⇒ Object
20 21 22 23 |
# File 'lib/dynamic_controller/responder.rb', line 20 def new action :new, html: Proc.new {} end |
#show ⇒ Object
14 15 16 17 18 |
# File 'lib/dynamic_controller/responder.rb', line 14 def show action :show, html: Proc.new {}, json: Proc.new { render json: model } end |
#update ⇒ Object
36 37 38 39 40 |
# File 'lib/dynamic_controller/responder.rb', line 36 def update action :update, html: Proc.new { redirect_to action: :show, id: model.id }, json: Proc.new { head :no_content } end |