summaryrefslogtreecommitdiff
path: root/app/controllers/my
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-05-21 22:27:06 -0600
committermo khan <mo@mokhan.ca>2014-05-21 22:27:06 -0600
commit1ea8b4a3094aed558448edd93704f7964521a15a (patch)
treeb42ca829409b7421d54da46a9a39104605817f1b /app/controllers/my
parenta1d8ec3d5dbb7a62c7bc45866b2363c749238862 (diff)
move settings to my/settings.
Diffstat (limited to 'app/controllers/my')
-rw-r--r--app/controllers/my/base_controller.rb8
-rw-r--r--app/controllers/my/settings_controller.rb23
2 files changed, 24 insertions, 7 deletions
diff --git a/app/controllers/my/base_controller.rb b/app/controllers/my/base_controller.rb
index d8ea0c48..3a0e1335 100644
--- a/app/controllers/my/base_controller.rb
+++ b/app/controllers/my/base_controller.rb
@@ -1,11 +1,5 @@
module My
class BaseController < ApplicationController
- before_filter :restrict_access!
-
- private
-
- def restrict_access!
- redirect_to root_path unless signed_in?
- end
+ before_filter :authenticate_user!
end
end
diff --git a/app/controllers/my/settings_controller.rb b/app/controllers/my/settings_controller.rb
new file mode 100644
index 00000000..013b66c6
--- /dev/null
+++ b/app/controllers/my/settings_controller.rb
@@ -0,0 +1,23 @@
+module My
+ class SettingsController < BaseController
+ def index
+ @user = current_user
+ end
+
+ def update
+ @user = current_user
+ @user.interest_ids = params[:user][:interest_ids] ||= []
+ if @user.update_without_password(user_params)
+ redirect_to my_settings_path, :notice => t(:profile_saved)
+ else
+ render :index
+ end
+ end
+
+ private
+
+ def user_params
+ params.require(:user).permit(:name, :email, :city, :website, :twitter, :facebook)
+ end
+ end
+end