diff --git a/app/presenters/locomotive/base_presenter.rb b/app/presenters/locomotive/base_presenter.rb index f298cc88..925bb5ce 100644 --- a/app/presenters/locomotive/base_presenter.rb +++ b/app/presenters/locomotive/base_presenter.rb @@ -22,12 +22,14 @@ class Locomotive::BasePresenter self.source.persisted? || self.source.embedded? ? self.source._id.to_s : nil end + alias :_id :id + def ability? self.ability.present? end def included_methods - %w(id created_at updated_at) + %w(id _id created_at updated_at) end def as_json(methods = nil) diff --git a/config/routes.rb b/config/routes.rb index c1407810..87b2c53e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,6 +67,8 @@ Rails.application.routes.draw do resources :snippets + resources :pages + end end diff --git a/lib/locomotive/action_controller/responder.rb b/lib/locomotive/action_controller/responder.rb index 38b0dd10..a474751d 100644 --- a/lib/locomotive/action_controller/responder.rb +++ b/lib/locomotive/action_controller/responder.rb @@ -45,8 +45,10 @@ module Locomotive set_flash_message! message = controller.flash[type] - controller.headers['X-Message'] = message - controller.headers['X-Message-Type'] = type + unless message.blank? + controller.headers['X-Message'] = message + controller.headers['X-Message-Type'] = type + end yield if block_given?