Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Remove use of attr_protected
Browse files Browse the repository at this point in the history
This is no longer required as I'm using strong parameters. Removing this
now should make the upgrade to Rails 4 go a little smoother.
  • Loading branch information
chrisroos committed Nov 13, 2013
1 parent 142ea03 commit 650adac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
2 changes: 0 additions & 2 deletions app/models/transaction.rb
Expand Up @@ -40,8 +40,6 @@ def self.description_search(query)
validates_presence_of :account_id, :original_date, :name, :amount_in_pence, :fit_id, :type, :original_description
validates_uniqueness_of :fit_id

attr_protected :original_date, :name, :amount_in_pence, :type, :fit_id, :memo, :original_description

before_validation :set_original_description, on: :create

def amount
Expand Down
16 changes: 0 additions & 16 deletions test/unit/transaction_test.rb
@@ -1,22 +1,6 @@
# encoding: utf-8
require 'test_helper'

class TransactionProtectedAttributesTest < ActiveSupport::TestCase
{
original_date: Date.parse('2011-01-01'),
name: 'ofx-name',
amount_in_pence: 123,
type: 'ofx-type',
fit_id: 'ofx-fit-id',
memo: 'ofx-memo',
original_description: 'original-description'
}.each do |protected_attribute, value|
test "should not allow mass assignment of #{protected_attribute}" do
assert_raise(ActiveModel::MassAssignmentSecurity::Error) { Transaction.new(protected_attribute => value) }
end
end
end

class TransactionValidationTest < ActiveSupport::TestCase
test 'should be valid when build from the factory' do
transaction = FactoryGirl.build(:transaction)
Expand Down

0 comments on commit 650adac

Please sign in to comment.