I am experiencing a weird bug after adding this to my Alternative
-model:
default_scope order(:number)
On the first page refresh, everything works fine. On subsequent refreshes, I get
NoMethodError in Pages#show
undefined method `written?' for #<Alternative:0x10455c558>
Alternative
most assuredly has the written?
method. I am running Passenger, so after a
touch tmp/restart.txt
the page works again. For the first refresh. But the error message is back on subsequent refreshes again. Removing the default_scope
solves the issue (but only after another server restart).
Edit: The bug is also present when running on WEBrick through rails server
, so it is not connected to Passenger.
Edit: written?
is an instance method on Alternative
. The bug also appears when trying to access methods gained through has_many
, like this:
has_many :restrictions
alternative.restrictions.empty? # => NoMethodError
Anyone else experiencing problems with default_scope
in Rails 3? Or have a solution? Thanks!