Class: Muck::ProfilesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Muck::ProfilesController
- Defined in:
- app/controllers/muck/profiles_controller.rb
Instance Method Summary collapse
- #edit ⇒ Object
- #index ⇒ Object
-
#show ⇒ Object
show a given user’s public profile information.
- #update ⇒ Object
Instance Method Details
#edit ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/muck/profiles_controller.rb', line 20 def edit @page_title = t('muck.profiles.edit_profile') @user = User.find(params[:user_id]) @profile = @user.profile respond_to do |format| format.pjs do render_as_html do render :template => 'profiles/edit', :layout => false # fancybox request end end format.html { render :template => 'profiles/edit' } end end |
#index ⇒ Object
4 5 6 7 8 |
# File 'app/controllers/muck/profiles_controller.rb', line 4 def index respond_to do |format| format.html { render :template => 'profiles/index' } end end |
#show ⇒ Object
show a given user’s public profile information
11 12 13 14 15 16 17 18 |
# File 'app/controllers/muck/profiles_controller.rb', line 11 def show @user = User.find(params[:id]) @profile = @user.profile @page_title = @user.display_name respond_to do |format| format.html { render :template => 'profiles/show' } end end |
#update ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/muck/profiles_controller.rb', line 34 def update @page_title = t('muck.profiles.edit_profile') @user = User.find(params[:user_id]) @profile = @user.profile @profile.update_attributes!(params[:profile]) respond_to do |format| flash[:notice] = t('muck.profiles.edit_success') format.html { redirect_back_or_default edit_user_profile_path(@user) } end rescue ActiveRecord::RecordInvalid => ex flash[:error] = t('muck.profiles.edit_failure') render :action => :edit end |