在cloud9中,当我使用'rails s'时会出现此错误。它是什么?

时间:2018-07-31 08:26:48

标签: ruby-on-rails ruby

ec2-user:~/environment/research (master) $ rails s

=> Booting Puma
=> Rails 5.2.0 application starting in development 
=> Run `rails server -h` for more startup options
Exiting

/usr/local/rvm/gems/ruby-2.4.1/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load': /home/ec2-user/environment/research/app/models/user.rb:9: syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '(' (SyntaxError)

s_many :liked_posts, through :likes, source :post
                             ^
/home/ec2-user/environment/research/app/models/user.rb:12: syntax error, unexpected ':'
    Like.find_by(user.id: self.id, post_id: post.id).pr
                        ^
/home/ec2-user/environment/research/app/models/user.rb:12: syntax error, unexpected tLABEL, expecting '='
_by(user.id: self.id, post_id: post.id).present?
                               ^
/home/ec2-user/environment/research/app/models/user.rb:12: syntax error, unexpected ')', expecting keyword_end
id: self.id, post_id: post.id).present?
                             ^

1 个答案:

答案 0 :(得分:0)

user.id 

应该是

user_id

through: :likes