You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
最近になって知った Railsの便利なメソッドを紹介したいと思います。 pluck http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-pluck User.select(:id).where("age >= ?", 20).map(&:id) こんなコードが User.where("age >= ?", 20).pluck(:id) こうなります Rails3系では指定できるカラムはひとつだけでしたが、Rails4から複数カラムを指定できるようになりました。 User.where("age >= ?", 20).pluck(:id, :name) #=> [[1, '太郎'], [2, '花子'], [3, '二郎']] Rails3系でもmultipluck というgemを使えば同じことが
Active Support is the Ruby on Rails component responsible for providing Ruby language extensions and utilities. It offers a richer bottom-line at the language level, targeted both at the development of Rails applications, and at the development of Ruby on Rails itself. After reading this guide, you will know: What Core Extensions are. How to load all extensions. How to cherry-pick just the extensi
Class methods (1) lookup_missing_generator (<= v2.3.8) Instance methods (58) ` (<= v5.2.3) acts_like? app (<= v3.1.0) as_json blank? bundler? (<= v3.2.13) class_eval (<= v2.3.8) controller (<= v3.1.0) copy_instance_variables_from (<= v3.0.9) create (<= v3.0.9) create_fixtures (<= v5.1.7) deep_dup destroy (<= v3.0.9) duplicable? edit (<= v3.0.9) extended_by (<= v2.3.8) extend_with_included_module..
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く