2014-01-21 27 views
4

我有一個軌道4驗證了我的用戶模型:軌道4語法早該匹配器「have_many」與「秩序」

has_many :items, -> { order(:position) }

我期待下面早該匹配的工作:
it {should have_many(:items).order(:position)}

但它提出了這樣的錯誤:
Expected User to have a has_many association called items (items should be ordered by position)

是我的語法錯誤的,工商業污水附加費T'

回答

3

v2.4.0中有一個錯誤,在這裏沒有工作。這已在v2.5.0中修復,請檢查它!

請參閱這裏瞭解更多:https://github.com/thoughtbot/shoulda-matchers/issues/388

+0

謝謝。這是問題所在。 –

+0

@MichaelvanHolst [接受](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)答案是否正確 – gotva

+0

@MichaelvanHolst你能接受答案,以便其他人看到這個? –