alfa-jpn / kakurenbo Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi.
I"m using this gem instead of acts as paranoid on Rails 4.1.7.
This gem is very useful, Thanks:)
By the way, I found the issue on calling destroy_all after 'where'.
You can reproduce this issue on this repo.
And I've created a patch to avoid this issue.
Please check it.
Regards.
P.S
I think this patch looks bad resolver because it can't do exhaustive test and lose maintenability.
It might be hard way that adding options to argument...
いつも便利に使用させて頂いております。
paper_trailのバージョンアップにより、kakurenboでエラーとなるようです。
paper_trailが3.0.3時はエラーとならないようです。
確認お願いできますと幸いです。
バージョンは以下となります。
activerecord 4.1.4
paper_trail 3.0.6
kakurenbo 0.2.2
以下ログになります。
/project/vendor/bundle/ruby/2.0.0/gems/kakurenbo-0.2.2/lib/kakurenbo/mixin_ar_base.rb:28:in `remove_instance_variable': instance variable @table_name not defined (NameError)
from /project/vendor/bundle/ruby/2.0.0/gems/kakurenbo-0.2.2/lib/kakurenbo/mixin_ar_base.rb:28:in `block in inherited'
from /project/vendor/bundle/ruby/2.0.0/gems/kakurenbo-0.2.2/lib/kakurenbo/mixin_ar_base.rb:24:in `instance_eval'
from /project/vendor/bundle/ruby/2.0.0/gems/kakurenbo-0.2.2/lib/kakurenbo/mixin_ar_base.rb:24:in `inherited'
from /project/vendor/bundle/ruby/2.0.0/gems/paper_trail-3.0.6/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb:4:in `<module:PaperTrail>'
from /project/vendor/bundle/ruby/2.0.0/gems/paper_trail-3.0.6/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb:3:in `<top (required)>'
I want to use kakurenbo on Rails4.1(activerecord4.1) or more.
But environment of Rails4.1 was failed specs.
I sent pull-request just now, #7.
include the following:
As a result, I was found to have failed travisCI by activerecord environment.
https://travis-ci.org/alfa-jpn/kakurenbo/builds/28500214
activerecord version | spec result |
---|---|
~> 3.2.16 | failed |
~> 4.0.2 | success |
~> 4.1.0 | failed |
Now, I work in progress to support Rails4.1 at my fork repository.
In reference to rubysherpas/paranoia@9dac34c
MyForkedRepository:
https://github.com/yusabana/kakurenbo/tree/support_activerecord4.0_over
I'm using PostgreSQL. It seems that kakurenbo ignores self.table_name and cause SQL error. My model is coded as below.
class Admin < ActiveRecord::Base
self.table_name = 'admin'
end
And when I run rails console
and try below, it seems that kakurenbo tries admins
table (plural, ignoring table_name) .
$ bundle exec rails c
Loading development environment (Rails 4.0.3)
irb(main):001:0> Admin.count
PG::UndefinedTable: ERROR: relation "admins" does not exist
LINE 5: WHERE a.attrelid = '"admins"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"admins"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
(1.2ms) SELECT COUNT(*) FROM "admin"
=> 3986
When I commented out gem 'kakurenbo'
on Gemfile
, it worked as I intended.
以下の様なことをしようとした場合、
kakurenboを使用していると、
子クラスでselectした場合、親クラスのselectが走っています。
確認いただけると幸いです。
» Railsで複数のデータベースを使用する TECHSCORE BLOG
http://www.techscore.com/blog/2012/12/12/rails%E3%81%A7%E8%A4%87%E6%95%B0%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.