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

respond_with not working on specific controller #491

Closed
trobrock opened this Issue Jan 17, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@trobrock

trobrock commented Jan 17, 2014

I have two controllers in a Rails 4.0.2 app (CapsulesController and InstancesController). respond_with does not use the serializer I have for Capsule, but InstancesController will use the Instance serializer I have. The controllers and serializers are here: https://gist.github.com/trobrock/a574870dff5fafbc2115

I can get the serializer to kick in if I use respond_to in CapsulesController's index action.

Any idea why this would happen?

@Breefield

This comment has been minimized.

Breefield commented Feb 20, 2014

I have also experienced this, the README claims that respond_with uses the serializer because it uses to_json, however I have not found this to be true.

respond_to is working because you are explicitly stating render json:... I presume, which afaik is the easiest way to make your AMS work.

respond_to do |f|
    f.html {}
    f.json { render json: @animals }
  end
@lucasts

This comment has been minimized.

lucasts commented Mar 28, 2014

I dont think it help a lot, but I'm suffering from the same issue.

respond_with isn't using serializer at all

@steveklabnik steveklabnik added the bug label Aug 22, 2014

@steveklabnik

This comment has been minimized.

Contributor

steveklabnik commented Aug 22, 2014

respond_with has since been removed from Rails itself, and I don't consider it to be good practice. If someone wants to fix this, they can, but realistically, I'm not going to, so rather than give you false hope, I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment