You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Created a new Rails app for the first time in a long time. Added Devise, generated models and ran migrations successfully.
Expected behavior
A bootable app.
Actual behavior
The call to the devise method that was automatically inserted into my user.rb file throws syntax errors:
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable :registerable
:recoverable, :rememberable, :validatable
enum :role, [:user, :admin, :superadmin]
after_initialize :set_default_role, if: :new_record?
# set default role to user if not set
def set_default_role
self.role ||= :user
end
end
% rails server
=> Booting Puma
=> Rails 7.2.2 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/myuser/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': --> /Users/myuser/dev/myorg/alfalfa/app/models/user.rb
expected a newline or semicolon after the statementcannot parse the expression
1 class User < ApplicationRecord
> 4 devise :database_authenticatable :registerable
> 5 :recoverable, :rememberable, :validatable
> 7 enum :role, [:user, :admin, :superadmin]
15 end
/Users/myuser/dev/myorg/alfalfa/app/models/user.rb:4: syntax error, unexpected ':', expecting `end' or dummy end (SyntaxError)
...ise :database_authenticatable :registerable
... ^
/Users/myuser/dev/myorg/alfalfa/app/models/user.rb:5: syntax error, unexpected ',', expecting `end' or dummy end
:recoverable, :rememberable, :validatable
^
Did I get some incompatible version mismatches somehow?
The text was updated successfully, but these errors were encountered:
Environment
Current behavior
Created a new Rails app for the first time in a long time. Added Devise, generated models and ran migrations successfully.
Expected behavior
A bootable app.
Actual behavior
The call to the
devise
method that was automatically inserted into myuser.rb
file throws syntax errors:Did I get some incompatible version mismatches somehow?
The text was updated successfully, but these errors were encountered: