Make contacts_visible accessible
This commit is contained in:
parent
8c9a7e1c41
commit
716a7f64b8
2 changed files with 2 additions and 8 deletions
|
|
@ -38,9 +38,6 @@ class AspectsController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@aspect = current_user.aspects.create(params[:aspect])
|
@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?
|
if @aspect.valid?
|
||||||
flash[:notice] = I18n.t('aspects.create.success', :name => @aspect.name)
|
flash[:notice] = I18n.t('aspects.create.success', :name => @aspect.name)
|
||||||
|
|
@ -129,9 +126,6 @@ class AspectsController < ApplicationController
|
||||||
@aspect = current_user.aspects.where(:id => params[:id]).first
|
@aspect = current_user.aspects.where(:id => params[:id]).first
|
||||||
|
|
||||||
if @aspect.update_attributes!(params[:aspect])
|
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
|
flash[:notice] = I18n.t 'aspects.update.success', :name => @aspect.name
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
|
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class Aspect < ActiveRecord::Base
|
||||||
validates_length_of :name, :maximum => 20
|
validates_length_of :name, :maximum => 20
|
||||||
validates_uniqueness_of :name, :scope => :user_id, :case_sensitive => false
|
validates_uniqueness_of :name, :scope => :user_id, :case_sensitive => false
|
||||||
|
|
||||||
attr_accessible :name
|
attr_accessible :name, :contacts_visible
|
||||||
|
|
||||||
before_validation do
|
before_validation do
|
||||||
name.strip!
|
name.strip!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue