Homeland 本地想把 homeland 项目跑起来,但是报错了

xinyuanjieyi · 2023年09月11日 · 最后由 evelynwang 回复于 2025年10月01日 · 457 次阅读

ruby 3.0.3 rails 7.0.6

用 docker 安装了 postgres,可以正确连接,我想用 rails s 启动起来,报错:

WARNING: table: "settings" does not exist or not database connection, `Setting.rack_attack` fallback to returns the default value.
WARNING: table: "settings" does not exist or not database connection, `Setting.rack_attack` fallback to returns the default value.
--> /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User < ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User < ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

--> /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User < ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User < ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

--> /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User < ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User < ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

/Users/jieyi/.rvm/gems/ruby-3.0.3/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': /Users/jieyi/workspace/study/homeland/app/models/user.rb:68: syntax error, unexpected ')' (SyntaxError)
    fetch_by_uniq_keys(email:)
                             ^
/Users/jieyi/workspace/study/homeland/app/models/user.rb:72: syntax error, unexpected ')'
...cord::RecordNotFound.new(slug:))
...                              ^
/Users/jieyi/workspace/study/homeland/app/models/user.rb:168: syntax error, unexpected end-of-input, expecting `end'

It looks like there are syntax errors in your User model, particularly with the fetch_by_uniq_keys(email:) and raise(ActiveRecord::RecordNotFound.new(slug:)) lines. The issue seems to be related to missing arguments or incorrect syntax. Double-check the method definitions and ensure all required arguments are passed correctly. Additionally, make sure your database migrations are up-to-date to avoid issues like the missing settings table. If you are also learning to code you might find tools like grade calculator helpful for organizing and tracking your grades.

需要 登录 后方可回复, 如果你还没有账号请 注册新账号