Closed djolereject closed 1 year ago
this is really gross, but it could work:
module ABadHack
extend ActiveSupport::Concern
included do
rescue_from ActiveRecord::RecordNotFound do
# ...
end
end
end
module Trestle
def self.resource(name, options={}, &block)
object = Resource::Builder.create(name, options, &block)
object.const_get(:AdminController).include ABadHack
register(object)
end
end
Thanks, I thought of something similar, but you are right in that it's really not pretty :)
I'm trying to add
rescue_from
to all Trestle controllers and can't find the way to do so. My idea was to do something inconfig/initializers/trestle.rb
, but it appears I can't just accessTrestle::AdminController
norTrestle::ApplicationController
. Is there any way of doing this?