1. C

    Cannot Query Parent with Many to Many Association - Rails

    I have 3 models with the following structure: class Customer has_many :invoices has_and_belongs_to_many :locations end class Invoice belongs_to :customer end class Location has_and_belongs_to_many :customers end I'm trying to write a query that will grab invoices that have...
  2. C

    Undefined method exists? for Draper::CollectionDecorator

    I am trying to implement the Draper gem for my Rails project and having trouble getting it to work. I'm getting the error message: undefined method `exists?' for #Draper::CollectionDecorator:0x000055b625da7a10> The error seems to be coming up from a partial I'm rendering on my index view. The...
  3. O

    How to handle malformed json for a route with 'defaults: {format: :json}'?

    I have a url which is supposed to accept only json: put "/my_url" => "my_controller#my_actio", defaults: {format: :json} When I send malformed json to it, it doesn't make to an "action" at all and instead it throws an exception somewhere in Rails and thus my app ends up returning the error...