Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backporting #2226 to 3.0 stable #2759

Closed
wants to merge 2 commits into from
Closed

Conversation

simi
Copy link
Contributor

@simi simi commented Jan 29, 2013

Hello. I have similar problem (https://github.com/mongoid/mongoid/issues/2226).

Any chance to get this backported to 3.0 and release new version?

Thanks, Josef

Allows the generation of URLs of deleted models. Makes it easier to
create a list of trashed models (a.k.a Trash view). Helps me with #2226.

Signed-off-by: Mario Uher <uher.mario@gmail.com>
@simi
Copy link
Contributor Author

simi commented Jan 29, 2013

OK, I have better solution for this. Will be pull requested in moment.

@simi simi closed this Jan 29, 2013
@simi
Copy link
Contributor Author

simi commented Jan 29, 2013

OK, I think this is enough for backport to 3.0.

But I have different idea. We should redefine persisted? in Mongoid::State to take care of paranoid (and set self.paranoid=false for unparanoided model).

like this:

def persisted?
  paranoid ? (!new_record?) : (!new_record? && !destroyed?)
end

After we can remove this from Mongoid::Paranoia

def to_param
  new_record? ? nil : to_key.join('-')
end

Because I think it's true that object is persisted when it's deleted and some methods like to_param relies on that fact. But this change is candidate for 3.1 or 4.0 version if you're interested in. I can submit PR if you'll like it.

@simi simi reopened this Jan 29, 2013
@durran
Copy link
Member

durran commented Feb 2, 2013

I've pulled the commit from #2226 back into the 3.0.0-stable. As for the other changes I'll have a closer look for 3.1.

@durran durran closed this Feb 2, 2013
@simi
Copy link
Contributor Author

simi commented Feb 2, 2013

I see only one commit in 3.0 stable. But another one is needed also @durran.

simi@7e22111

@simi
Copy link
Contributor Author

simi commented Feb 2, 2013

And for that improvement for Paranoia. I was heavily inspired by this solution (https://github.com/radar/paranoia/blob/master/lib/paranoia.rb).

durran added a commit that referenced this pull request Feb 2, 2013
@durran
Copy link
Member

durran commented Feb 2, 2013

Yeah I think that gem will be the way to go - I probably won't be doing much work work in this area being close to the 3.1 release at the moment, also given that we are removing it in 4.0.

@simi
Copy link
Contributor Author

simi commented Feb 2, 2013

@durran ok, thanks. Should I decouple paranoia in separate gem? I'm really interested in it now.

@durran
Copy link
Member

durran commented Feb 2, 2013

@simi That would be great! It definitely would be nice to have some love around it.

@simi
Copy link
Contributor Author

simi commented Feb 2, 2013

@durran I decoupled it https://github.com/simi/mongoid-paranoia.

@durran durran added the fixed label May 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants