LoginSignup
0
0

More than 5 years have passed since last update.

Arelで足したカラムのAS付けが出来ない?

Posted at

以下の方法でASで名づけたいんですが、出来ないのかな。

user_table = User.arel_table
(user_table[:a_count] + user_table[:b_count]).as("score")
> (user_table[:a_count] + user_table[:b_count]).as("score")
NoMethodError: undefined method `as' for #<Arel::Nodes::Grouping:0x007f7aeac179f8>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0