Module: Outpost
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/outpost/list.rb,
lib/outpost.rb,
lib/outpost/test.rb,
lib/outpost/model.rb,
lib/outpost/config.rb,
lib/outpost/engine.rb,
lib/outpost/helpers.rb,
lib/outpost/version.rb,
lib/outpost/list/base.rb,
lib/outpost/controller.rb,
lib/outpost/breadcrumbs.rb,
lib/outpost/list/column.rb,
lib/outpost/list/filter.rb,
lib/outpost/model/naming.rb,
lib/outpost/model/methods.rb,
lib/outpost/model/routing.rb,
lib/outpost/helpers/naming.rb,
lib/outpost/model/identifier.rb,
lib/outpost/model/serializer.rb,
lib/outpost/controller/actions.rb,
lib/outpost/controller/helpers.rb,
lib/outpost/controller/ordering.rb,
lib/outpost/model/authorization.rb,
lib/outpost/controller/callbacks.rb,
lib/outpost/controller/filtering.rb,
lib/outpost/model/authentication.rb,
lib/outpost/controller/preferences.rb,
lib/outpost/controller/authorization.rb,
lib/outpost/controller/custom_errors.rb,
lib/outpost/controller/authentication.rb,
app/controllers/outpost/resource_controller.rb,
app/controllers/outpost/sessions_controller.rb,
app/controllers/outpost/application_controller.rb
Overview
Authorization
Basic authorization methods for controllers
Defined Under Namespace
Modules: Breadcrumbs, Controller, Helpers, List, Model, Test Classes: ApplicationController, BaseController, Breadcrumb, Config, Engine, ErrorsController, HomeController, ResourceController, SessionsController
Constant Summary collapse
- OBJ_KEY_REGEX =
%r{([^-]+)-(\d+)}
- DESCENDING =
"DESC"
- ASCENDING =
"ASC"
- VERSION =
"0.1.4"
Class Attribute Summary collapse
Class Method Summary collapse
-
.obj_by_key(key) ⇒ Object
——————– Convert key from “app/model:id” to AppModel.find_by_id(id).
-
.obj_by_key!(key) ⇒ Object
——————– Same as #obj_by_key, but raises ActiveRecord::RecordNotFound if no object is found or if key doesn’t match.
-
.user_class ⇒ Object
TODO can we cache this in development?.
Class Attribute Details
Class Method Details
.obj_by_key(key) ⇒ Object
Convert key from “app/model:id” to AppModel.find_by_id(id)
39 40 41 42 43 44 |
# File 'lib/outpost.rb', line 39 def obj_by_key(key) if match = match_key(key) model = model_classes[match[1]] model.find_by_id(match[2]) if model end end |
.obj_by_key!(key) ⇒ Object
Same as #obj_by_key, but raises ActiveRecord::RecordNotFound if no object is found or if key doesn’t match.
49 50 51 |
# File 'lib/outpost.rb', line 49 def obj_by_key!(key) obj_by_key(key) or raise ActiveRecord::RecordNotFound end |
.user_class ⇒ Object
TODO can we cache this in development?
33 34 35 |
# File 'lib/outpost.rb', line 33 def user_class config.user_class.constantize end |