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

ActiveModel Serializer #87

Open
blimey85 opened this issue Jul 4, 2017 · 0 comments
Open

ActiveModel Serializer #87

blimey85 opened this issue Jul 4, 2017 · 0 comments

Comments

@blimey85
Copy link

blimey85 commented Jul 4, 2017

I have your gem setup and working great however I need to format the data that gets returned. The call is triggering a lookup for which serializer to use but I can't for the life of me figure out how to name the serializer so it gets detected. I'm stumped by it not being a regular method in my controller.

Here's the output I get when hitting the autocomplete url:

Started GET "/venues/autocomplete_venue_name?term=The" for 127.0.0.1 at 2017-07-03 23:50:11 -0400
Processing by VenuesController#autocomplete_venue_name as JSON
  Parameters: {"term"=>"The"}
  Venue Load (0.2ms)  SELECT  venues.id, venues.name, `venues`.`id`, `venues`.`name`, `venues`.`address`, `venues`.`city`, `venues`.`state`, `venues`.`zipcode` FROM `venues` WHERE (LOWER(venues.name) LIKE '%the%') ORDER BY LOWER(venues.name) ASC LIMIT 10
  User Load (0.2ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 2 ORDER BY `users`.`id` ASC LIMIT 1
No serializer found for resource: {"id"=>"1", "label"=>"The Geek Easy", "value"=>"The Geek Easy", :id=>1, :name=>"The Geek Easy", :address=>"114 S Semoran Blvd #6", :city=>"Winter Park", :state=>"FL", :zipcode=>32792}
[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with Array (0.1ms)
Completed 200 OK in 8ms (Views: 6.0ms | ActiveRecord: 0.5ms)

I have other serializers that work fine but it's serializers/venues/show_serializer.rb and that works great for the show method. Just need to know the naming scheme for this. Thanks!

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

1 participant