diff --git a/Gemfile b/Gemfile index 6a1a0874c7ef95d41055fe67a3c7d217e17639cb..59087dbd4f6eaba8d779d8d040ac258bb024c843 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 3ab954a68512089444de4cab943661b77c455279..4bbd21c941ffca84b29fdbb40512322de03574a8 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 c82b1f43b3051180b8d1e7470e6e1b425f3ce803..86e50604a40f66a1b0e8854a12bf4046eaa2a352 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 361e4d934a1ea3b6bc0f8116be546416a9860441..1eba8f4c8def2cd799c85769c5b5018b8d10d76c 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 92d9cb8e86fc89d21e6b170359b87c1d086a536c..0ee9f6ed7709d6988a801912edce8d0a09988e1b 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 394c1f5fd4296bc114794b892a532de8cedf2aa0..69fdcd47cf7fa8b20209eea92e220ea4b8fbe798 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)