ActiveRecordでselectした値から主キーを抜く
内容
User.select(:必要なカラム名1, :必要なカラム名2).as_json(:except => :id)
pluckだとなんか違うって時に。
参考記事
[https://stackoverflow.com/questions/33391062/how-to-remove-id-from-select-active-record:embed:cite]
User.select(:必要なカラム名1, :必要なカラム名2).as_json(:except => :id)
pluckだとなんか違うって時に。
[https://stackoverflow.com/questions/33391062/how-to-remove-id-from-select-active-record:embed:cite]