diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 947762b2052055327ef2fc54d8247de471a23bd9..631eb653b87b994ab1ce657f2cc0795cb2fd9656 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -38,9 +38,6 @@ class AspectsController < ApplicationController def create @aspect = current_user.aspects.create(params[:aspect]) - # hack, we don't know why mass assignment is not working - @aspect.contacts_visible = params[:aspect][:contacts_visible] - @aspect.save if @aspect.valid? flash[:notice] = I18n.t('aspects.create.success', :name => @aspect.name) @@ -98,7 +95,7 @@ class AspectsController < ApplicationController def edit @aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts => {:person => :profile}).first - + @contacts_in_aspect = @aspect.contacts.includes(:person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } c = Contact.arel_table if @contacts_in_aspect.empty? @@ -129,9 +126,6 @@ class AspectsController < ApplicationController @aspect = current_user.aspects.where(:id => params[:id]).first if @aspect.update_attributes!(params[:aspect]) - #hack, we don't know why mass assignment is not working - @aspect.contacts_visible = params[:aspect][:contacts_visible] - @aspect.save flash[:notice] = I18n.t 'aspects.update.success', :name => @aspect.name else flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name diff --git a/app/models/aspect.rb b/app/models/aspect.rb index be6da529f54f4e98442a593a97c68fd53440beca..0fd4a82534114d325fef151dd7132b831eb2e8b2 100644 --- a/app/models/aspect.rb +++ b/app/models/aspect.rb @@ -15,7 +15,7 @@ class Aspect < ActiveRecord::Base validates_length_of :name, :maximum => 20 validates_uniqueness_of :name, :scope => :user_id, :case_sensitive => false - attr_accessible :name + attr_accessible :name, :contacts_visible before_validation do name.strip!