Open hunterae opened 9 months ago
The gem also prevents upgrading to Rails 7.
The issue seems to stem from the fact that the gem is dynamically defining "id" on Symbol. I added a fix by on my fork (https://github.com/hunterae/parse-stack) by hacking the method definition for Parse::Operation.register as follows (here's the commit: https://github.com/hunterae/parse-stack/commit/a0cdc652a106528fef43c3cec22d26350f47b39b):
module Parse
class Operation
def self.register(op, klass)
Operation.operators[op.to_sym] = klass
# Hack to get this working in Rails 6.1
op = :object_id if op.to_sym == :id
Symbol.send :define_method, op do |value = nil|
operation = Operation.new self, op
value.nil? ? operation : operation.constraint(value)
end
end
end
end
I'm not making a PR for this commit as I imagine it breaks some of the existing functionality and I don't understand that portion of the functionality well enough to add a proper fix.
I have setup a simple demonstration app to show this issue: https://github.com/hunterae/rails6-1_parse-stack-issue
Essentially, when using Rails 6.1.6 (also confirmed with 6.1.7), and parse-stack 1.9.1 (also confirmed with 1.8.0), and mysql2 0.5.6 (also confirmed with 0.5.4), whenever you attempt to run "rake db:migrate", you get an error that says "TypeError: can't quote Parse::Operation".
The full error stack looks like this: /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/quoting.rb:240:in'
Tasks: TOP => db:migrate
_quote' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/quoting.rb:20:in
quote' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/collectors/substitute_binds.rb:20:inadd_bind' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:699:in
visit_Arel_Nodes_BindParam' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/visitor.rb:30:invisit' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:610:in
visit_Arel_Nodes_Equality' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/visitor.rb:30:invisit' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:779:in
block in inject_join' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:777:ineach' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:777:in
each_with_index' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:777:ininject_join' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:177:in
collect_nodes_for' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:157:invisit_Arel_Nodes_SelectCore' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/mysql.rb:30:in
visit_Arel_Nodes_SelectCore' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:124:inblock in visit_Arel_Nodes_SelectStatement' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:123:in
each' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:123:ininject' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:123:in
visit_Arel_Nodes_SelectStatement' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/mysql.rb:25:invisit_Arel_Nodes_SelectStatement' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/visitor.rb:30:in
visit' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/visitor.rb:11:inaccept' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/arel/visitors/to_sql.rb:18:in
compile' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:37:into_sql_and_binds' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:64:in
select_all' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/query_cache.rb:103:inselect_all' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql/database_statements.rb:12:in
select_all' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/querying.rb:47:infind_by_sql' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:843:in
block in exec_queries' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:861:inskip_query_cache_if_necessary' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:828:in
exec_queries' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:631:inload' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:249:in
records' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation/finder_methods.rb:524:infind_take' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation/finder_methods.rb:98:in
take' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation/finder_methods.rb:81:infind_by' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:226:in
find_or_initialize_by' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/querying.rb:22:infind_or_initialize_by' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/internal_metadata.rb:35:in
[]=' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1310:inrecord_environment' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1303:in
migrate_without_lock' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:inblock in migrate' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1401:in
block in with_advisory_lock' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:inblock in with_advisory_lock_connection' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in
with_connection' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:inwith_advisory_lock_connection' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1397:in
with_advisory_lock' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:inmigrate' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1086:in
up' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1061:inmigrate' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in
migrate' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:inblock (3 levels) in <main>' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in
each' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:inblock (2 levels) in <main>' /Users/hunterae/.rvm/gems/ruby-2.7.8/gems/rake-13.1.0/exe/rake:27:in
<top (required)>' /Users/hunterae/.rvm/gems/ruby-2.7.8/bin/ruby_executable_hooks:22:ineval' /Users/hunterae/.rvm/gems/ruby-2.7.8/bin/ruby_executable_hooks:22:in