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

Sequel generator error #195

Open
dawidof opened this issue Sep 4, 2023 · 3 comments
Open

Sequel generator error #195

dawidof opened this issue Sep 4, 2023 · 3 comments

Comments

@dawidof
Copy link

dawidof commented Sep 4, 2023

On running rails g sequel:model products name line_item:references, recieng an error

D, [2023-09-04T13:46:05.104980 #95318] DEBUG -- :   Sequel::Postgres::Database (0.2ms)  SET standard_conforming_strings = ON
D, [2023-09-04T13:46:05.105250 #95318] DEBUG -- :   Sequel::Postgres::Database (0.1ms)  SET client_min_messages = 'WARNING'
D, [2023-09-04T13:46:05.105467 #95318] DEBUG -- :   Sequel::Postgres::Database (0.1ms)  SET DateStyle = 'ISO'
/Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/generated_attribute.rb:65:in `valid_type?': uninitialized constant #<Class:Rails::Generators::GeneratedAttribute>::ActiveRecord (NameError)

            ActiveRecord::Base.connection.valid_type?(type)
                        ^^^^^^
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/generated_attribute.rb:46:in `parse'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/named_base.rb:184:in `block in parse_attributes!'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/named_base.rb:183:in `map'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/named_base.rb:183:in `parse_attributes!'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators/named_base.rb:17:in `initialize'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor/group.rb:226:in `new'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor/group.rb:226:in `dispatch'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/generators.rb:263:in `invoke'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/commands/generate/generate_command.rb:26:in `perform'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/command/base.rb:87:in `perform'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/command.rb:48:in `invoke'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/railties-7.0.7.2/lib/rails/commands.rb:18:in `<main>'
	from <internal:/Users/dmytro/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/dmytro/.rvm/rubies/ruby-3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/dmytro/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:6:in `<main>'

my application.rb

# frozen_string_literal: true

require_relative 'boot'

require 'rails'
require 'active_job/railtie'
require 'active_model/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
# require 'active_record/railtie'
# require "active_storage/engine"
# require "action_mailbox/engine"
# require "action_text/engine"
# require "action_cable/engine"
# require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Backend
  class Application < Rails::Application
    config.load_defaults 7.0
    config.active_job.queue_adapter = :sidekiq

    config.time_zone = 'UTC'

    config.api_only = true

    I18n.available_locales = %i[en]
    I18n.default_locale = :en
    config.generators.system_tests = nil

    config.sequel.after_connect = proc do
      Sequel::Model.plugin :timestamps, update_on_create: true
      Sequel::Model.plugin :enum
      Sequel::Model.plugin :pretty_print
      Sequel::Model.plugin :tactical_eager_loading
      Sequel::Model.db.extension :pg_array, :pg_json, :pg_range, :pagination
      Sequel.default_timezone = :utc
    end
  end
end
@JonathanTron
Copy link
Member

Hi @dawidof, thanks for reporting the issue.

Maybe you still have some config referencing one of the commented out rails deps, one which loads ActiveRecord ?

@JonathanTron
Copy link
Member

@dawidof I created a new rails 7 app, and modified the application.rb like you did and I was able to run rails g sequel:model products name line_item:references properly.
So I suspect there's another dependency requiring ActiveRecord, maybe something in your Gemfile.

@dawidof
Copy link
Author

dawidof commented Sep 5, 2023

No I don’t have any ActiveRecord dependencies

Screenshot 2023-09-05 at 11 58 52 Screenshot 2023-09-05 at 11 58 29

Here is my Gemfile

# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'

gem 'bootsnap', require: false
gem 'devise', '~> 4.9'
gem 'dotenv-rails'
gem 'dry-initializer'
gem 'dry-validation'
gem 'graphql', '2.0.26'
gem 'graphql-batch'
gem 'jwt', '~> 2.7'
gem 'pg', '~> 1.5', '< 2.0'
gem 'puma', '~> 6.3'
gem 'pundit', '~> 2.3'
gem 'rack-cors'
gem 'rails', '7.0.7.2'
gem 'sequel-devise', github: 'ontohub/sequel-devise', ref: '643e86f'
gem 'sequel_postgresql_triggers', '~> 1.5'
gem 'sequel_pretty_print'
gem 'sequel-rails', github: 'TalentBox/sequel-rails', ref: '6ecf211'
gem 'sidekiq', '~> 7'
gem 'sidekiq-scheduler', '~> 5.0'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

group :development, :test do
  gem 'amazing_print'
  gem 'bullet'
  gem 'byebug', platforms: %i[mri mingw x64_mingw]
  gem 'factory_bot_rails'
  gem 'ffaker', '~> 2.21'
  gem 'pry'
  gem 'rspec-rails'
end

group :development do
  gem 'brakeman'
  gem 'rubocop', '~> 1.56.0', require: false
  gem 'rubocop-factory_bot', require: false
  gem 'rubocop-graphql', require: false
  gem 'rubocop-performance', require: false
  gem 'rubocop-rails', require: false
  gem 'rubocop-rspec', '~> 2.19', require: false
  gem 'rubocop-sequel', require: false
end

group :test do
  gem 'database_cleaner-sequel'
  gem 'fivemat'
  gem 'simplecov', require: false
  gem 'webmock'
end

AND Gemfile.lock

GIT
  remote: https://github.com/TalentBox/sequel-rails.git
  revision: 6ecf2114b6065f0b1b0c087d81043c7f0c9ebe9f
  ref: 6ecf211
  specs:
    sequel-rails (1.2.0)
      actionpack (>= 4.0.0)
      activemodel (>= 4.0.0)
      railties (>= 4.0.0)
      sequel (>= 3.28, < 6.0)

GIT
  remote: https://github.com/ontohub/sequel-devise.git
  revision: 643e86f50cfcc3be797a2a236a7ca874d610ebf7
  ref: 643e86f
  specs:
    sequel-devise (0.0.13)
      devise
      orm_adapter-sequel
      sequel (>= 3.11.0)

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.0.7.2)
      actionpack (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (7.0.7.2)
      actionpack (= 7.0.7.2)
      activejob (= 7.0.7.2)
      activerecord (= 7.0.7.2)
      activestorage (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      mail (>= 2.7.1)
      net-imap
      net-pop
      net-smtp
    actionmailer (7.0.7.2)
      actionpack (= 7.0.7.2)
      actionview (= 7.0.7.2)
      activejob (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      mail (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.0)
    actionpack (7.0.7.2)
      actionview (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      rack (~> 2.0, >= 2.2.4)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (7.0.7.2)
      actionpack (= 7.0.7.2)
      activerecord (= 7.0.7.2)
      activestorage (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.0.7.2)
      activesupport (= 7.0.7.2)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (7.0.7.2)
      activesupport (= 7.0.7.2)
      globalid (>= 0.3.6)
    activemodel (7.0.7.2)
      activesupport (= 7.0.7.2)
    activerecord (7.0.7.2)
      activemodel (= 7.0.7.2)
      activesupport (= 7.0.7.2)
    activestorage (7.0.7.2)
      actionpack (= 7.0.7.2)
      activejob (= 7.0.7.2)
      activerecord (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      marcel (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (7.0.7.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    addressable (2.8.5)
      public_suffix (>= 2.0.2, < 6.0)
    amazing_print (1.5.0)
    ast (2.4.2)
    base64 (0.1.1)
    bcrypt (3.1.19)
    bootsnap (1.16.0)
      msgpack (~> 1.2)
    brakeman (6.0.1)
    builder (3.2.4)
    bullet (7.0.7)
      activesupport (>= 3.0.0)
      uniform_notifier (~> 1.11)
    byebug (11.1.3)
    coderay (1.1.3)
    concurrent-ruby (1.2.2)
    connection_pool (2.4.1)
    crack (0.4.5)
      rexml
    crass (1.0.6)
    database_cleaner-core (2.0.1)
    database_cleaner-sequel (2.0.2)
      database_cleaner-core (~> 2.0.0)
      sequel
    date (3.3.3)
    devise (4.9.2)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0)
      responders
      warden (~> 1.2.3)
    diff-lcs (1.5.0)
    docile (1.4.0)
    dotenv (2.8.1)
    dotenv-rails (2.8.1)
      dotenv (= 2.8.1)
      railties (>= 3.2)
    dry-configurable (1.1.0)
      dry-core (~> 1.0, < 2)
      zeitwerk (~> 2.6)
    dry-core (1.0.1)
      concurrent-ruby (~> 1.0)
      zeitwerk (~> 2.6)
    dry-inflector (1.0.0)
    dry-initializer (3.1.1)
    dry-logic (1.5.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0, < 2)
      zeitwerk (~> 2.6)
    dry-schema (1.13.3)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 1.0, >= 1.0.1)
      dry-core (~> 1.0, < 2)
      dry-initializer (~> 3.0)
      dry-logic (>= 1.4, < 2)
      dry-types (>= 1.7, < 2)
      zeitwerk (~> 2.6)
    dry-types (1.7.1)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0)
      dry-inflector (~> 1.0)
      dry-logic (~> 1.4)
      zeitwerk (~> 2.6)
    dry-validation (1.10.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0, < 2)
      dry-initializer (~> 3.0)
      dry-schema (>= 1.12, < 2)
      zeitwerk (~> 2.6)
    erubi (1.12.0)
    et-orbi (1.2.7)
      tzinfo
    factory_bot (6.2.1)
      activesupport (>= 5.0.0)
    factory_bot_rails (6.2.0)
      factory_bot (~> 6.2.0)
      railties (>= 5.0.0)
    ffaker (2.22.0)
    fivemat (1.3.7)
    fugit (1.8.1)
      et-orbi (~> 1, >= 1.2.7)
      raabro (~> 1.4)
    globalid (1.1.0)
      activesupport (>= 5.0)
    graphql (2.0.26)
    graphql-batch (0.5.3)
      graphql (>= 1.12.18, < 3)
      promise.rb (~> 0.7.2)
    hashdiff (1.0.1)
    i18n (1.14.1)
      concurrent-ruby (~> 1.0)
    json (2.6.3)
    jwt (2.7.1)
    language_server-protocol (3.17.0.3)
    loofah (2.21.3)
      crass (~> 1.0.2)
      nokogiri (>= 1.12.0)
    mail (2.8.1)
      mini_mime (>= 0.1.1)
      net-imap
      net-pop
      net-smtp
    marcel (1.0.2)
    method_source (1.0.0)
    mini_mime (1.1.5)
    minitest (5.19.0)
    msgpack (1.7.2)
    net-imap (0.3.7)
      date
      net-protocol
    net-pop (0.1.2)
      net-protocol
    net-protocol (0.2.1)
      timeout
    net-smtp (0.3.3)
      net-protocol
    nio4r (2.5.9)
    nokogiri (1.15.4-aarch64-linux)
      racc (~> 1.4)
    nokogiri (1.15.4-arm64-darwin)
      racc (~> 1.4)
    nokogiri (1.15.4-x86_64-darwin)
      racc (~> 1.4)
    nokogiri (1.15.4-x86_64-linux)
      racc (~> 1.4)
    orm_adapter (0.5.0)
    orm_adapter-sequel (0.1.0)
      activemodel (>= 3.0.0)
      orm_adapter (>= 0.4.0)
      sequel (>= 3.18.0)
    parallel (1.23.0)
    parser (3.2.2.3)
      ast (~> 2.4.1)
      racc
    pg (1.5.3)
    promise.rb (0.7.4)
    pry (0.14.2)
      coderay (~> 1.1)
      method_source (~> 1.0)
    public_suffix (5.0.3)
    puma (6.3.1)
      nio4r (~> 2.0)
    pundit (2.3.1)
      activesupport (>= 3.0.0)
    raabro (1.4.0)
    racc (1.7.1)
    rack (2.2.8)
    rack-cors (2.0.1)
      rack (>= 2.0.0)
    rack-test (2.1.0)
      rack (>= 1.3)
    rails (7.0.7.2)
      actioncable (= 7.0.7.2)
      actionmailbox (= 7.0.7.2)
      actionmailer (= 7.0.7.2)
      actionpack (= 7.0.7.2)
      actiontext (= 7.0.7.2)
      actionview (= 7.0.7.2)
      activejob (= 7.0.7.2)
      activemodel (= 7.0.7.2)
      activerecord (= 7.0.7.2)
      activestorage (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      bundler (>= 1.15.0)
      railties (= 7.0.7.2)
    rails-dom-testing (2.2.0)
      activesupport (>= 5.0.0)
      minitest
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.6.0)
      loofah (~> 2.21)
      nokogiri (~> 1.14)
    railties (7.0.7.2)
      actionpack (= 7.0.7.2)
      activesupport (= 7.0.7.2)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
      zeitwerk (~> 2.5)
    rainbow (3.1.1)
    rake (13.0.6)
    redis-client (0.16.0)
      connection_pool
    regexp_parser (2.8.1)
    responders (3.1.0)
      actionpack (>= 5.2)
      railties (>= 5.2)
    rexml (3.2.6)
    rspec-core (3.12.2)
      rspec-support (~> 3.12.0)
    rspec-expectations (3.12.3)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-mocks (3.12.6)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-rails (6.0.3)
      actionpack (>= 6.1)
      activesupport (>= 6.1)
      railties (>= 6.1)
      rspec-core (~> 3.12)
      rspec-expectations (~> 3.12)
      rspec-mocks (~> 3.12)
      rspec-support (~> 3.12)
    rspec-support (3.12.1)
    rubocop (1.56.2)
      base64 (~> 0.1.1)
      json (~> 2.3)
      language_server-protocol (>= 3.17.0)
      parallel (~> 1.10)
      parser (>= 3.2.2.3)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.8, < 3.0)
      rexml (>= 3.2.5, < 4.0)
      rubocop-ast (>= 1.28.1, < 2.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 2.4.0, < 3.0)
    rubocop-ast (1.29.0)
      parser (>= 3.2.1.0)
    rubocop-capybara (2.18.0)
      rubocop (~> 1.41)
    rubocop-factory_bot (2.23.1)
      rubocop (~> 1.33)
    rubocop-graphql (1.4.0)
      rubocop (>= 0.90, < 2)
    rubocop-performance (1.19.0)
      rubocop (>= 1.7.0, < 2.0)
      rubocop-ast (>= 0.4.0)
    rubocop-rails (2.20.2)
      activesupport (>= 4.2.0)
      rack (>= 1.1)
      rubocop (>= 1.33.0, < 2.0)
    rubocop-rspec (2.23.2)
      rubocop (~> 1.33)
      rubocop-capybara (~> 2.17)
      rubocop-factory_bot (~> 2.22)
    rubocop-sequel (0.3.4)
      rubocop (~> 1.0)
    ruby-progressbar (1.13.0)
    rufus-scheduler (3.9.1)
      fugit (~> 1.1, >= 1.1.6)
    sequel (5.71.0)
    sequel_postgresql_triggers (1.5.0)
      sequel
    sequel_pretty_print (0.2)
      sequel
    sidekiq (7.1.2)
      concurrent-ruby (< 2)
      connection_pool (>= 2.3.0)
      rack (>= 2.2.4)
      redis-client (>= 0.14.0)
    sidekiq-scheduler (5.0.3)
      rufus-scheduler (~> 3.2)
      sidekiq (>= 6, < 8)
      tilt (>= 1.4.0)
    simplecov (0.22.0)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
      simplecov_json_formatter (~> 0.1)
    simplecov-html (0.12.3)
    simplecov_json_formatter (0.1.4)
    thor (1.2.2)
    tilt (2.2.0)
    timeout (0.4.0)
    tzinfo (2.0.6)
      concurrent-ruby (~> 1.0)
    unicode-display_width (2.4.2)
    uniform_notifier (1.16.0)
    warden (1.2.9)
      rack (>= 2.0.9)
    webmock (3.19.0)
      addressable (>= 2.8.0)
      crack (>= 0.3.2)
      hashdiff (>= 0.4.0, < 2.0.0)
    websocket-driver (0.7.6)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    zeitwerk (2.6.11)

PLATFORMS
  aarch64-linux
  arm64-darwin-22
  x86_64-darwin-22
  x86_64-linux

DEPENDENCIES
  amazing_print
  bootsnap
  brakeman
  bullet
  byebug
  database_cleaner-sequel
  devise (~> 4.9)
  dotenv-rails
  dry-initializer
  dry-validation
  factory_bot_rails
  ffaker (~> 2.21)
  fivemat
  graphql (= 2.0.26)
  graphql-batch
  jwt (~> 2.7)
  pg (~> 1.5, < 2.0)
  pry
  puma (~> 6.3)
  pundit (~> 2.3)
  rack-cors
  rails (= 7.0.7.2)
  rspec-rails
  rubocop (~> 1.56.0)
  rubocop-factory_bot
  rubocop-graphql
  rubocop-performance
  rubocop-rails
  rubocop-rspec (~> 2.19)
  rubocop-sequel
  sequel-devise!
  sequel-rails!
  sequel_postgresql_triggers (~> 1.5)
  sequel_pretty_print
  sidekiq (~> 7)
  sidekiq-scheduler (~> 5.0)
  simplecov
  tzinfo-data
  webmock

RUBY VERSION
   ruby 3.2.2p53

BUNDLED WITH
   2.4.17

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

No branches or pull requests

2 participants