How to use remove_from_list method of ActiveRecord with scope as public in the model?

231 Views Asked by At

Lets say my model is C . Obj - @c

C has acts_as_list gem defined as acts_as_list scope: '...'

and scope as : scope :public -> {where (some_condition)}

When writing rspec for @c.remove_from_list , the test fails with ArgumentError(1 for 0). However, if I rename the scope to any keyword other than public , for ex:

scope :publi -> {where (some_condition)}

the test passes .

PS. I am not passing any arguments in my spec.

Is there a constraint on using scope as public while using aacts_as_list gem ?

1

There are 1 best solutions below

0
Afan On

There is no additional method public in the model. However on researching a bit more into this realized that the gem acts_as_list inserts the method name (in this case remove_from_list as an argument in the public scope method. Fixed this by placing (*args) in the method definition.

Thanks @Brendon Muir for the suggestion.