diff --git a/app/controllers/application.rb b/app/controllers/application.rb index a0676a9..bb49a27 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -53,12 +53,7 @@ class ApplicationController < ActionController::Base def render_not_found(path = nil) @path ||= request.path # raise "#{@path} not found" - render(:file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404) && false - end - - def load_profile - @profile = Profile.find_by_identifier(params[:profile]) - render_not_found unless @profile + render(:file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404) && fal end def user diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index c46b654..4e05b9d 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -1,2 +1,3 @@ class ProfileController < ApplicationController + needs_profile end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6801154..7b09fcb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -162,7 +162,7 @@ module ApplicationHelper # should be a current profile (i.e. while viewing some profile's pages, or the # profile info, etc), because if there is no profile an exception is thrown. def profile - @profile || raise("There is no current profile") + @controller.send(:profile) || raise("There is no current profile") end # create a form field structure (as if it were generated with diff --git a/lib/needs_profile.rb b/lib/needs_profile.rb index d339662..7db2348 100644 --- a/lib/needs_profile.rb +++ b/lib/needs_profile.rb @@ -20,4 +20,9 @@ module NeedsProfile @profile end + def load_profile + @profile = Profile.find_by_identifier(params[:profile]) + render_not_found unless @profile + end + end -- libgit2 0.21.2