Commit 8fdf6ddf3b6731501c135a9f55d2c5ca18938d00
1 parent
28a4bf83
Exists in
master
and in
23 other branches
ActionItem154: cleaning up; modularizing the load_profile behaviour
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1255 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
8 additions
and
7 deletions
Show diff stats
app/controllers/application.rb
| ... | ... | @@ -53,12 +53,7 @@ class ApplicationController < ActionController::Base |
| 53 | 53 | def render_not_found(path = nil) |
| 54 | 54 | @path ||= request.path |
| 55 | 55 | # raise "#{@path} not found" |
| 56 | - render(:file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404) && false | |
| 57 | - end | |
| 58 | - | |
| 59 | - def load_profile | |
| 60 | - @profile = Profile.find_by_identifier(params[:profile]) | |
| 61 | - render_not_found unless @profile | |
| 56 | + render(:file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404) && fal | |
| 62 | 57 | end |
| 63 | 58 | |
| 64 | 59 | def user | ... | ... |
app/controllers/public/profile_controller.rb
app/helpers/application_helper.rb
| ... | ... | @@ -162,7 +162,7 @@ module ApplicationHelper |
| 162 | 162 | # should be a current profile (i.e. while viewing some profile's pages, or the |
| 163 | 163 | # profile info, etc), because if there is no profile an exception is thrown. |
| 164 | 164 | def profile |
| 165 | - @profile || raise("There is no current profile") | |
| 165 | + @controller.send(:profile) || raise("There is no current profile") | |
| 166 | 166 | end |
| 167 | 167 | |
| 168 | 168 | # create a form field structure (as if it were generated with | ... | ... |