Created
July 1, 2014 18:11
-
-
Save tristanoneil/b20321c6bd06f6f400a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):022:0> Cookbook.find_by(name: 'mysql').cookbook_versions.sort_by { |v| Semverse::Version.new(v.version) }.reverse.first | |
Cookbook Load (0.6ms) SELECT "cookbooks".* FROM "cookbooks" WHERE "cookbooks"."name" = 'mysql' LIMIT 1 | |
CookbookVersion Load (2.5ms) SELECT "cookbook_versions".* FROM "cookbook_versions" WHERE "cookbook_versions"."cookbook_id" = $1 [["cookbook_id", 699]] | |
=> #<CookbookVersion id: 2861, cookbook_id: 699, license: "Apache 2.0", version: "4.1.2", created_at: "2014-02-28 10:27:00", updated_at: "2014-02-28 10:27:00", tarball_file_name: "mysql20140228-22364-1stzk6m", tarball_content_type: "application/x-tar", tarball_file_size: 26275, tarball_updated_at: "2014-02-28 10:26:56", readme: "mysql Cookbook\n==============\n[![Build Status](htt...", readme_extension: "md", dependencies_imported: true, description: "Installs and configures mysql for client or server", legacy_id: 6009, web_download_count: 65, api_download_count: 0, verification_state: "pending"> | |
irb(main):023:0> Cookbook.includes(:cookbook_versions).find_by(name: 'mysql').cookbook_versions.sort_by { |v| Semverse::Version.new(v.version) }.reverse.first | |
Cookbook Load (0.6ms) SELECT "cookbooks".* FROM "cookbooks" WHERE "cookbooks"."name" = 'mysql' LIMIT 1 | |
CookbookVersion Load (3.0ms) SELECT "cookbook_versions".* FROM "cookbook_versions" WHERE "cookbook_versions"."cookbook_id" IN (699) | |
=> #<CookbookVersion id: 2861, cookbook_id: 699, license: "Apache 2.0", version: "4.1.2", created_at: "2014-02-28 10:27:00", updated_at: "2014-02-28 10:27:00", tarball_file_name: "mysql20140228-22364-1stzk6m", tarball_content_type: "application/x-tar", tarball_file_size: 26275, tarball_updated_at: "2014-02-28 10:26:56", readme: "mysql Cookbook\n==============\n[![Build Status](htt...", readme_extension: "md", dependencies_imported: true, description: "Installs and configures mysql for client or server", legacy_id: 6009, web_download_count: 65, api_download_count: 0, verification_state: "pending"> | |
irb(main):024:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment