Class: Spree::BaseController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Spree::BaseController
- Defined in:
- app/controllers/spree/base_controller.rb
Direct Known Subclasses
Admin::BaseController, CheckoutsController, ContentController, CountriesController, OrdersController, PasswordResetsController, ProductsController, StatesController, TaxonsController, UserSessionsController, UsersController
Instance Method Summary collapse
- #access_forbidden ⇒ Object
- #default_title ⇒ Object
-
#find_order ⇒ Object
retrieve the order_id from the session and then load from the database (or return a new order if no such id exists in the session).
-
#initialize_extension_partials ⇒ Object
Used for pages which need to render certain partials in the middle of a view.
-
#set_title(title) ⇒ Object
set_title can be used in views as well as controllers.
- #title ⇒ Object
Methods inherited from ApplicationController
Methods included from EasyRoleRequirementSystem
Methods included from EasyRoleRequirementSystem::InstanceMethods
Methods included from RoleRequirementSystem
Instance Method Details
#access_forbidden ⇒ Object
18 19 20 |
# File 'app/controllers/spree/base_controller.rb', line 18 def access_forbidden render :text => 'Access Forbidden', :layout => true, :status => 401 end |
#default_title ⇒ Object
42 43 44 |
# File 'app/controllers/spree/base_controller.rb', line 42 def default_title Spree::Config[:site_name] end |
#find_order ⇒ Object
retrieve the order_id from the session and then load from the database (or return a new order if no such id exists in the session)
7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/spree/base_controller.rb', line 7 def find_order unless session[:order_id].blank? @order = Order.find_or_create_by_id(session[:order_id]) else @order = Order.create end session[:order_id] = @order.id session[:order_token] = @order.token @order end |
#initialize_extension_partials ⇒ Object
Used for pages which need to render certain partials in the middle of a view. Ex. Extra user form fields
24 25 26 |
# File 'app/controllers/spree/base_controller.rb', line 24 def initialize_extension_partials @extension_partials = [] end |
#set_title(title) ⇒ Object
set_title can be used in views as well as controllers. e.g. <% set_title ‘This is a custom title for this view’ %>
30 31 32 |
# File 'app/controllers/spree/base_controller.rb', line 30 def set_title(title) @title = title end |
#title ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/spree/base_controller.rb', line 34 def title if @title.blank? default_title else @title end end |