Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors when "Rendering from render" #85

Open
ak47 opened this issue Sep 30, 2014 · 2 comments
Open

errors when "Rendering from render" #85

ak47 opened this issue Sep 30, 2014 · 2 comments

Comments

@ak47
Copy link

ak47 commented Sep 30, 2014

the issue appears with the includes in the controller


class Api::V2::AppointmentsController < ApplicationController
  include ::Roar::Rails::ControllerAdditions
  include ::Roar::Rails::ControllerAdditions::Render

  # GET /api/v2/appointments/:id
  def show
    @appointment = Appointment.first
    if @appointment
      # render json: AppointmentRepresenter.new(@appointment).to_json, status: :ok
      render @appointment, status: :ok

in my rspecs, I consistently get:


Failure/Error: get "/api/v2/appointments/123"
     ActionController::RoutingError:
       undefined method `responder=' for Api::V2::AppointmentsController:Class
     # ./app/controllers/api/v2/appointments_controller.rb:2:in`include'

AND


 Failure/Error: get "/api/v2/appointments/#{@appointment.id}"
     AbstractController::ActionNotFound:
       The action 'show' could not be found for Api::V2::AppointmentsController

When remove those includes and use the alternative:


render json: AppointmentRepresenter.new(@appointment).to_json, status: :ok'

this works out as expected

Am I doing something wrong?

Ruby 2.1.2
Rails 4.1.5
Rspec 3.1.0

thanks

@apotonick
Copy link
Member

I remember this problem from a while ago (undefined method responder=') but thought we had it fixed. Can you find out where in Rails 4.1 the #responder= method is defined?

@apotonick
Copy link
Member

Does that help? #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants