Class: ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ApplicationController
- Defined in:
- lib/ecrire/app/controllers/application_controller.rb
Direct Known Subclasses
Admin::ApplicationController, Ecrire::ThemeController, ImagesController, OnboardingController, PartialsController, SessionsController
Instance Method Summary collapse
- #current_user ⇒ Object
-
#post_path(post, options = {}) ⇒ Object
This is the less ugly hack I could find.
- #signed_in? ⇒ Boolean
Instance Method Details
#current_user ⇒ Object
8 9 10 |
# File 'lib/ecrire/app/controllers/application_controller.rb', line 8 def current_user warden.user end |
#post_path(post, options = {}) ⇒ Object
This is the less ugly hack I could find. The reason why this is here is because helpers are hard to debug due to their anonymous Module use.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ecrire/app/controllers/application_controller.rb', line 18 def post_path(post, = {}) [:controller] = :posts [:action] = :show [:year] = post.published_at.year [:month] = post.published_at.month [:id] = (.delete(:title) || post.titles.first).slug theme.url_for end |
#signed_in? ⇒ Boolean
12 13 14 |
# File 'lib/ecrire/app/controllers/application_controller.rb', line 12 def signed_in? !warden.user.nil? end |