[rspec-users] collection-based finder methods

amkirwan amkirwan at gmail.com
Wed Jul 22 00:21:10 EDT 2009

How do I spec this following example from the Agile Rails Book listed
below. I am doing a similar thing in my controller and when I
attempted to change it to the collection way of doing the find I am
unable to get my spec to pass though I know it is working fine as my
cucumber features are passing

old rails way:

def show
@order = Order.find(params[:id])

new rails way collection-based:

def show
id = params[:id]
@order = @user.orders.find(id)
redirect_to :action => "index"

More information about the rspec-users mailing list