Sha256: d1ea978e187f2ab37c7efb145c9a781f6a468b327bb3065cf61123cbaa7b884e
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
class ProfilesController < ApplicationController before_filter :authenticate before_action :set_profile def show end def edit end def update if @profile.update_attributes(profile_params) if params[:profile][:portrait].present? render :crop ## Render the view for cropping else redirect_to profile_path, notice: "<strong><span class=\"glyphicon glyphicon-ok-sign\"></span> Success!</strong> Your profile was updated.".html_safe end else render action: "edit", warning: "<strong>Attention!</strong> A problem occurred while trying to update your profile. Plese try again".html_safe end end def history @activities = doer.activities.by_recent end private # Use callbacks to share common setup or constraints between actions. def set_profile @profile = Profile.find(current_user) end # Never trust parameters from the scary internet, only allow the white list through. def profile_params params.require(:profile).permit :email, :first_name, :last_name, :other_name, :teacher_status, :portrait, :website_url, :facebook_url, :twitter_handle, :google_plus_url, :allow_newsletter, :allow_daily_digests, :crop_x, :crop_y, :crop_w, :crop_h end end
Version data entries
7 entries across 7 versions & 1 rubygems