prevent pow to crash when no flash message (bug) + add api resources for pages

This commit is contained in:
did 2012-01-24 01:00:41 +01:00
parent 739d2db0a9
commit 0534c5504f
3 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -67,6 +67,8 @@ Rails.application.routes.draw do
resources :snippets resources :snippets
resources :pages
end end
end end

View File

@ -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?