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

Add have_a_version_with_changes matcher #881

Merged

Conversation

aried3r
Copy link
Member

@aried3r aried3r commented Oct 18, 2016

No description provided.

@jaredbeck
Copy link
Member

Looks good to me. Personally, I'm a little leery of where_object_changes because it uses a LIKE query, but that doesn't seem to bother other people, so I see no reason not to have a RSpec matcher for this.

@jaredbeck
Copy link
Member

On an unrelated note, I'd like to see the rspec stuff move into a separate gem (called rspec-paper_trail) eventually. Doesn't have to happen now.

@jaredbeck jaredbeck merged commit 5a2e709 into paper-trail-gem:master Oct 18, 2016
@jaredbeck
Copy link
Member

Merged. Thanks Anton!

@aried3r
Copy link
Member Author

aried3r commented Oct 18, 2016

because it uses a LIKE query

Shouldn't performance be a little be better when people are using the JSONB column type? Of course, without benchmarking, setting proper indices etc I'm merely speculating.

Anyway, here's the source for anyone who's seeing this on how it is implemented, depending on the column type:
https://github.com/airblade/paper_trail/blob/5-stable/lib/paper_trail/version_concern.rb#L144-L169

@batter
Copy link
Collaborator

batter commented Oct 18, 2016

Shouldn't performance be a little be better when people are using the JSONB column type? Of course, without benchmarking, setting proper indices etc I'm merely speculating.

I would think so, but also don't have benchmarks to prove that assertion.

Should we add a bit to the RSpec portion of the README regarding this feature?

@aried3r
Copy link
Member Author

aried3r commented Nov 2, 2016

I would think so, but also don't have benchmarks to prove that assertion.

I'd like to do some benchmarks, but how do you suggest such a benchmark should look like? I'm asking because since you guys write and maintain paper_trail, you guys probably know best. :)

I found this article on Rails and JSONB which also includes benchmarks (see code) which I'd like to base it on.

@jaredbeck
Copy link
Member

I'd like to do some benchmarks, but how do you suggest such a benchmark should look like?

You probably want to benchmark the SQL queries in isolation, without ruby. So, I would take the SQL generated by PT+AR, put it in a few .sql files, run them using psql and time.

@aried3r
Copy link
Member Author

aried3r commented Nov 3, 2016

You probably want to benchmark the SQL queries in isolation, without ruby.

Hmm, while this would measure the performance quite accurately for the PostgreSQL, wouldn't it be more useful for the users (most being Rails users, I guess) to measure "real world" performance, as in, using Ruby for the benchmark?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants