laserlemon / periscope Goto Github PK
View Code? Open in Web Editor NEWPush your models' scopes up to the surface.
Home Page: http://laserlemon.github.com/periscope
License: MIT License
Push your models' scopes up to the surface.
Home Page: http://laserlemon.github.com/periscope
License: MIT License
Does this gem support Rails 5? I tried using periscope-activerecord
with Rails 5 and got:
undefined local variable or method
scoped' for $MODEL_NAME`
Looks like this line is probably causing that:
https://github.com/laserlemon/periscope/blob/master/lib/periscope/adapters/active_record.rb#L12
def periscope_default_scope
::ActiveRecord::VERSION::MAJOR == 4 ? all : scoped
end
Updating a local copy of the gem worked for me. I opened a PR to update this: #9
Any plans for a Rails 4 compatible version? 4.0.0.beta seems to be out, so the full release shouldn't be too far away.
Are there plans to support Rails version 6 or 7 ?
I've tested this with Mongoid -- if the method
option is set to a method that is provided by Mongoid, it is used instead of a class method defined in the model.
It appears to be due to the fact that periscope calls scoped
before chaining the method calls.
[1] pry(MyModel)> show-method order_by
From: [REDACTED] @ line 133:
Owner: #<Class:MyModel>
Visibility: public
Number of lines: 4
def self.order_by(*criteria)
binding.pry
super
end
[2] pry(MyModel)> show-method scoped.order_by
From: /Users/greggory/.gem/ruby/1.9.3/gems/origin-1.1.0/lib/origin/optional.rb @ line 166:
Owner: Origin::Optional
Visibility: public
Number of lines: 9
def order_by(*spec)
option(spec) do |options|
spec.compact.each do |criterion|
criterion.__sort_option__.each_pair do |field, direction|
add_sort_option(options, field, direction)
end
end
end
end
When a column name is 'open', it is unable to be used by periscope and needs to be renamed. The issue I get is Errno::ENOENT: No such file or directory @ rb_sysopen - 1
I get this error when doing the bundle:
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
activerecord (~> 5.1.0)
periscope-activerecord (~> 2.1.1) was resolved to 2.1.1, which depends on
activerecord (< 5.1, >= 3)
Hi there,
Will periscope_default_scope
be implemented soon? https://github.com/laserlemon/periscope/blob/master/lib/periscope.rb#L19
Thanks!
Is it possible to run periscope with Rails 2.3?
Thanks, uros
Hi there!
I'm wondering how when sorting on a specific column, how I can push all null values to the end, independent of sort direction.
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.