Modern Front-End Development for Rails B7: bin/setup (page xv)

Hi, I just got bitten by this issue when trying to run the initial bin/setup command:

To work with the latest versions I’ve had to lock down the gemfile:
gem “activerecord-postgres_enum”, ‘~> 1.6’

4 Likes

Thanks for catching that, must be that particular combination of versions.

I changed the migration to avoid a db enum:

    # create_enum(:enum_ilk, %w[concert meet_n_greet battle])
    # create_enum(:enum_access, %w[general members vips])

    create_table(:concerts) do |t|
      t.string(:name)
      t.text(:description)
      t.datetime(:start_time)
      t.references(:venue, null: false, foreign_key: true)
      t.text(:genre_tags)
      # t.enum(:ilk, enum_name: :enum_ilk)
      # t.enum(:access, enum_name: :enum_access)
      t.integer :ilk
      t.integer :access

      t.timestamps
    end

and in the model

  # enum ilk: {concert: "concert", meet_n_greet: "meet_n_greet", battle: "battle"}
  # enum access: {general: "general", members: "members", vips: "vips"}
  enum ilk: %w[concert meet_n_greet battle]
  enum access: %w[general members vips]

That’ll also work, it’s not really an issue for any of the other code, maybe it’s worth pulling back to that in the final code in the name of having one less dependency.

1 Like

I got the same with Rails 6.1.0, PostgreSQL 9.6 under Amazon Linux 2.