prevent pow to crash when no flash message (bug) + add api resources for pages
This commit is contained in:
parent
739d2db0a9
commit
0534c5504f
@ -22,12 +22,14 @@ class Locomotive::BasePresenter
|
|||||||
self.source.persisted? || self.source.embedded? ? self.source._id.to_s : nil
|
self.source.persisted? || self.source.embedded? ? self.source._id.to_s : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias :_id :id
|
||||||
|
|
||||||
def ability?
|
def ability?
|
||||||
self.ability.present?
|
self.ability.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def included_methods
|
def included_methods
|
||||||
%w(id created_at updated_at)
|
%w(id _id created_at updated_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(methods = nil)
|
def as_json(methods = nil)
|
||||||
|
@ -67,6 +67,8 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :snippets
|
resources :snippets
|
||||||
|
|
||||||
|
resources :pages
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ module Locomotive
|
|||||||
set_flash_message!
|
set_flash_message!
|
||||||
message = controller.flash[type]
|
message = controller.flash[type]
|
||||||
|
|
||||||
controller.headers['X-Message'] = message
|
unless message.blank?
|
||||||
controller.headers['X-Message-Type'] = type
|
controller.headers['X-Message'] = message
|
||||||
|
controller.headers['X-Message-Type'] = type
|
||||||
|
end
|
||||||
|
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user