It seems this interacts badly with the default_scope on postgres (but
not on sqlite3). Error message from the logs:
2013-06-01T02:21:05.312099+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
2013-06-01T02:21:05.312099+00:00 app[web.1]: LINE 1: ...photo_id" = 2 AND "plantings"."id" = 181 ORDER BY created_at...
2013-06-01T02:21:05.312099+00:00 app[web.1]: app/controllers/photos_controller.rb:59:in `create'
2013-06-01T02:21:05.312099+00:00 app[web.1]: ^
2013-06-01T02:21:05.312099+00:00 app[web.1]: : SELECT DISTINCT 1 AS one FROM "plantings" INNER JOIN "photos_plantings" ON "plantings"."id" = "photos_plantings"."planting_id" WHERE "photos_plantings"."photo_id" = 2 AND "plantings"."id" = 181 ORDER BY created_at desc LIMIT 1):
For now, we'll just have to rely on the controller (which adds the
association) to keep things unique.
Strictly speaking this doesn't prevent you adding them if you really
try, but the validation for that was beyond what I could figure out (the
docs don't help, and all SO/blog posts are outdated and didn't
work).
However, if you do somehow manage to add dups, you will never see them
again thanks to the :uniq => true in the model. That's good enough for
me.
now if you choose to pay 33.33 it doesn't round to 33.00
also removed PUT and DELETE actions from order items
(we don't want them for now, can reinstate later if/when we do.)
This works fine in reality, but we can't figure out how to write tests
for it. For some reason the @member object, which passes a test for
is_paid?, doesn't get recognised as such when it's passed through to the
view itself. Help?
Set up a validation to make sure there's only ever one account_detail
attached to a member. This broke a bunch of tests, and means you
basically can't use a factory to generate account details. Instead, to
test account details, create a member and then look at their account
details.
These are failing because we set CanCan to not allow these actions. We
might want to delete them entirely, actually, but I'm not quite sure
yet, so for now I'm just marking as pending.