norman/friendly_id — Issue #250: spec tests failing when using association
Author: klebershimabuku
Created: 2012-03-04 07:31:28+00:00
State: open

I have a simple post > user association and when using Friendly_id, I can see my tests failing because of this line.

Post Load (0.2ms) SELECT `posts`.* FROM `posts` WHERE `posts`.`user_id` = 101 AND `posts`.`id` = 0 ORDER BY posts.created_at DESC LIMIT 1

as you can see, posts.id is passing as value 0.

while when I perform the same tests, commenting out the lines referencing to the Friendly_id from my Post model, test are passing and you can see a different query been generated.

Post Load (0.3ms) SELECT `posts`.* FROM `posts` WHERE `posts`.`user_id` = 101 AND `posts`.`id` = 515 ORDER BY posts.created_at DESC LIMIT 1

where posts.id value is passing.