support boolean with default set to false, rather than NULL, and all tests passed #108

Closed
wants to merge 8 commits into
from

Projects

None yet

4 participants

@mvj3
Contributor
mvj3 commented Apr 9, 2013

refer to this issue #27

@mikegee
mikegee commented May 15, 2013

@mvj3 I also had this problem with a boolean deleted column, and your fork fixes it. But, now I'm getting this warning:

DEPRECATION WARNING: You're trying to create an attributeid'. Writing arbitrary attributes on a model is deprecated. Please just use attr_writer etc.`

Below I've pasted rspec I'm using to verify that acts_as_paranoid is working in my app. The warning coming from line 11, record.save(validate: false)

Do you have any idea why I might be getting this?

Thanks!

shared_examples 'a model with soft-delete' do
  it 'should have a column to mark deleted records' do
    expect(described_class).to respond_to(:paranoid_column)
    expect(described_class.column_names).to include(described_class.paranoid_column.to_s)
  end

  describe 'deleting a record' do
    let(:record) { described_class.new }

    before do
      record.save(validate: false)
      record.destroy
      @key = record.public_send(described_class.primary_key)
    end

    it 'should not be found by regular means' do
      expect{described_class.find(@key)}.to raise_error(ActiveRecord::RecordNotFound)
    end

    it 'should still be in the db, marked as deleted' do
      expect(described_class.with_deleted.find(@key)).to be_present
    end
  end
end
@mvj3
Contributor
mvj3 commented Jun 17, 2013

@mikegee I pull the rails3.2 branch, and all tests are passed.

As the warning said, "Please just use attr_writer etc."

Or take a look at http://stackoverflow.com/a/9634844/595618 , hope it helps.

@zzak
Collaborator
zzak commented May 12, 2014

@mvj3 Thank you for the patch, please rebase your patch against technoweenie/acts_as_paranoid@master branch.

@zzak zzak closed this May 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment