ããã«ã¡ã¯ã¼ã Railsã§ããç¨åº¦ã®è¦æ¨¡ã®éçºããã¦ããã¨ãã¡ãã£ã¨è¾¼ã¿å ¥ã£ãå½¢ã®SQLã§ãã¼ã¿ãåå¾ãããç¶æ³ãçºçãã¦ãã¾ãã ä»åã¯ããããªã¨ãã«å½¹ç«ã¤ActiveRecordã¯ã¨ãªã®ãã¯ããã¯ããç´¹ä»ãã¾ãã ã¡ãªã¿ã«execute()ãarelã¯ä½¿ãã¾ããã ï¼ç°å¢: Ruby 2.5.3, Rails 6.1.3ï¼ selectãã´ãªã´ãªæ¸ã ActiveRecordã®selectã¨ããã¡ã½ãããããã¾ãã åºæ¬çãªä½¿ãæ¹ã¨ãã¦ã¯ããããªæãã§ãå¿ è¦ãªã«ã©ã ã ãåå¾ããããã®ãã®ã§ãã users = User.all.select(:id, :name) users.first.attributes # => {"id"=>1, "name"=>"Alice"} ãªãã§ãããSELECTå¥ãæååã§å¥½ãã«æ¸ããã¨ãã§ãã¾ããå¥åãä»ãã¦ãããã¨ã§ããã®ååã§å¤ãåå¾ã§ãã¾ã
{{#tags}}- {{label}}
{{/tags}}