acts_as_ordered plugin and scope

Adding :wrap => false to acts_as_ordered will stop the next and previous methods from wrapping around, that may be what you’re after.

-Jonathan.

Try scoping to the association and not the foreign key.

acts_as_ordered :scope => :country, :order => ‘name’

When you provide a string to :scope, it should be the piece of sql used in the where clause of the sql. If you use a symbol it will add _id and set a scope of ‘country_id = #{country_id}’.

I agree it’s not the best and probably isn’t documented either.

-Jonathan.

Please send me a failing test case so I can look at this further.

-Jonathan.

That test passes with the following models:

class Country < ActiveRecord::Base has_many :cities end

class City < ActiveRecord::Base belongs_to :country

acts_as_ordered :scope => :country, :order => ‘name’

end

-Jonathan.