Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

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

Closed
wants to merge 8 commits into from

Conversation

dchentech
Copy link
Contributor

refer to this issue #27

@mikegee
Copy link

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 attribute id'. 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

@dchentech
Copy link
Contributor Author

@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
Copy link
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants