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

How to use represents #135

Open
sbwoodside opened this issue Jun 2, 2017 · 1 comment
Open

How to use represents #135

sbwoodside opened this issue Jun 2, 2017 · 1 comment

Comments

@sbwoodside
Copy link

In the main Readme it says:

Represents Configuration

If you don't want to use conventions or pass representers you can configure them on the class level using ::represents. This will also call respond_to for you.

class SingersController < ApplicationController
represents :json, Musician

I have tried removing my show method and putting in represents, like this:

  include Roar::Rails::ControllerAdditions

  represents :json, Company
  # def show
  #   company = Company.find_by_id(params[:id])
  #   respond_with company
  # end

Error is: The action 'show' could not be found for CompaniesController.

Is this supposed to allow me to eliminate the various CRUD controller methods? If not, what does it do?

@Mr-Timur
Copy link

You comment your action 'show' in CompaniesController with '#' symbols. Remove that symbols on each line and try again.

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