Can't post to create
femto opened this issue · 1 comments
femto commented
My LaudsController is
class LaudsController < InheritedResources::Base
respond_to :html,:json
include HasScope
has_scope :match_id
end
but when post to create action it says,
NoMethodError: undefined method `new' for #Plucky::Query:0x...,
I believe using HasScope turnings it into some Plucky::Query(which is Laud.all)
lucasmazza commented
This isn't a bug on has_scope, but a compatiblity between inherited_resources and MongoMapper, as it looks like the MongoMapper scopes doesn't supports building operations like new
or build
. You might get this fixed by overriding the build_resource
(https://github.com/josevalim/inherited_resources/blob/master/lib/inherited_resources/base_helpers.rb#L58-L60) method on your controller to not apply the scopes when creating a new Laud
object.