Remove duplicates and bad code habits.
Remove some blank line. Do not chain bang methods.
This commit is contained in:
parent
66a07bd938
commit
9ca9a6f310
6 changed files with 13 additions and 9 deletions
6
Gemfile
6
Gemfile
|
|
@ -66,7 +66,7 @@ gem 'roxml', '3.1.6'
|
||||||
gem 'ruby-oembed', '0.8.8'
|
gem 'ruby-oembed', '0.8.8'
|
||||||
|
|
||||||
|
|
||||||
#Rails 4 integration
|
# Please remove when migrating to Rails 4
|
||||||
gem 'strong_parameters'
|
gem 'strong_parameters'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,10 +97,6 @@ gem 'haml', '4.0.3'
|
||||||
gem 'mobile-fu', '1.2.1'
|
gem 'mobile-fu', '1.2.1'
|
||||||
gem 'will_paginate', '3.0.4'
|
gem 'will_paginate', '3.0.4'
|
||||||
|
|
||||||
# Strong parameters
|
|
||||||
|
|
||||||
gem 'strong_parameters'
|
|
||||||
|
|
||||||
|
|
||||||
### GROUPS ####
|
### GROUPS ####
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ class InvitationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
inviter_params = params.require(:email_inviter).permit(:message, :locale, :emails)
|
|
||||||
emails = inviter_params[:emails].split(',').map(&:strip).uniq
|
emails = inviter_params[:emails].split(',').map(&:strip).uniq
|
||||||
|
|
||||||
valid_emails, invalid_emails = emails.partition { |email| valid_email?(email) }
|
valid_emails, invalid_emails = emails.partition { |email| valid_email?(email) }
|
||||||
|
|
@ -99,4 +98,8 @@ class InvitationsController < ApplicationController
|
||||||
session[key] = nil
|
session[key] = nil
|
||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def inviter_params
|
||||||
|
params.require(:email_inviter).permit(:message, :locale, :emails)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class ProfilesController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
# upload and set new profile photo
|
# 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
|
munge_tag_string
|
||||||
|
|
||||||
|
|
@ -78,4 +78,8 @@ class ProfilesController < ApplicationController
|
||||||
end
|
end
|
||||||
@profile_attrs[:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : ""
|
@profile_attrs[:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : ""
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
class Block < ActiveRecord::Base
|
class Block < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,8 @@ class User < ActiveRecord::Base
|
||||||
params[:image_url_small] = photo.url(:thumb_small)
|
params[:image_url_small] = photo.url(:thumb_small)
|
||||||
end
|
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)
|
if self.profile.update_attributes(params)
|
||||||
deliver_profile_update
|
deliver_profile_update
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
|
# Please remove when migrating to Rails 4
|
||||||
ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
|
ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue