diff --git a/Gemfile b/Gemfile index 6a1a0874c..59087dbd4 100644 --- a/Gemfile +++ b/Gemfile @@ -66,7 +66,7 @@ gem 'roxml', '3.1.6' gem 'ruby-oembed', '0.8.8' -#Rails 4 integration +# Please remove when migrating to Rails 4 gem 'strong_parameters' @@ -97,10 +97,6 @@ gem 'haml', '4.0.3' gem 'mobile-fu', '1.2.1' gem 'will_paginate', '3.0.4' -# Strong parameters - -gem 'strong_parameters' - ### GROUPS #### diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 3ab954a68..4bbd21c94 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -50,7 +50,6 @@ class InvitationsController < ApplicationController end def create - inviter_params = params.require(:email_inviter).permit(:message, :locale, :emails) emails = inviter_params[:emails].split(',').map(&:strip).uniq valid_emails, invalid_emails = emails.partition { |email| valid_email?(email) } @@ -99,4 +98,8 @@ class InvitationsController < ApplicationController session[key] = nil return value end + + def inviter_params + params.require(:email_inviter).permit(:message, :locale, :emails) + end end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index c82b1f43b..86e50604a 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -33,7 +33,7 @@ class ProfilesController < ApplicationController def update # upload and set new profile photo - @profile_attrs = params.require(:profile).permit(:first_name, :last_name, :gender, :bio, :location, :searchable, :tag_string, :nsfw, :date => [:year, :month, :day]) || {} + @profile_attrs = profile_params munge_tag_string @@ -78,4 +78,8 @@ class ProfilesController < ApplicationController end @profile_attrs[:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : "" end + + def profile_params + params.require(:profile).permit(:first_name, :last_name, :gender, :bio, :location, :searchable, :tag_string, :nsfw, :date => [:year, :month, :day]) || {} + end end diff --git a/app/models/block.rb b/app/models/block.rb index 361e4d934..1eba8f4c8 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -1,5 +1,4 @@ class Block < ActiveRecord::Base - belongs_to :person belongs_to :user diff --git a/app/models/user.rb b/app/models/user.rb index 92d9cb8e8..0ee9f6ed7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -326,7 +326,8 @@ class User < ActiveRecord::Base params[:image_url_small] = photo.url(:thumb_small) end - params.stringify_keys!.slice!(*(Profile.column_names+['tag_string', 'date'])) + params.stringify_keys! + params.slice!(*(Profile.column_names+['tag_string', 'date'])) if self.profile.update_attributes(params) deliver_profile_update true diff --git a/config/initializers/strong_parameters.rb b/config/initializers/strong_parameters.rb index 394c1f5fd..69fdcd47c 100644 --- a/config/initializers/strong_parameters.rb +++ b/config/initializers/strong_parameters.rb @@ -1 +1,2 @@ +# Please remove when migrating to Rails 4 ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)