回答編集履歴

1

生SQLアクセスの結果はハッシュの配列で戻ってくるので、それに修正

2015/08/12 23:20

投稿

rifuch
rifuch

スコア1901

test CHANGED
@@ -42,8 +42,8 @@
42
42
 
43
43
  result = ActiveRecord::Base.connection.select("select abstract from team_members where user_id = 0 and team_id = 1 limit 1")
44
44
 
45
- # => resultの中身は{abstract => 'hoge'}
45
+ # => resultの中身は[{abstract => 'hoge'}]
46
46
 
47
- result[:abstract]
47
+ result.first[:abstract]
48
48
 
49
49
  ```