{"id":19806495,"url":"https://github.com/monade/arel_ext","last_synced_at":"2025-11-11T19:29:01.437Z","repository":{"id":228664978,"uuid":"657622697","full_name":"monade/arel_ext","owner":"monade","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-23T13:27:54.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-11T06:21:36.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-23T13:14:42.000Z","updated_at":"2023-06-23T13:27:59.000Z","dependencies_parsed_at":"2024-03-19T22:10:37.769Z","dependency_job_id":"528ece0f-4eff-4389-824e-7880200bc76c","html_url":"https://github.com/monade/arel_ext","commit_stats":null,"previous_names":["monade/arel_ext"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Farel_ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Farel_ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Farel_ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monade%2Farel_ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monade","download_url":"https://codeload.github.com/monade/arel_ext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241150393,"owners_count":19918350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T09:07:43.017Z","updated_at":"2025-10-14T20:12:01.188Z","avatar_url":"https://github.com/monade.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Tests](https://github.com/monade/arel_ext/actions/workflows/test.yml/badge.svg)\n[![Gem Version](https://badge.fury.io/rb/arel_ext.svg)](https://badge.fury.io/rb/arel_ext)\n\n# arel_ext\n\nA set of extensions to ActiveRecord Arel.\n\n## Installation\n\nAdd the gem to your Gemfile\n\n```ruby\n  gem 'arel_ext'\n```\n\nAdd an initializer for the configuration:\n\n```ruby\nArelExt.install\n```\n\nAnd it's ready!\n\n## Usage\n\n### Simple SQL Functions invocation\nYou can easily invocate custom SQL functions, like string_agg:\n\n```ruby\nArelExt::Func.string_agg(Arel::Table.new('posts')[:title], ',') # =\u003e string_agg(\"posts\".\"title\", ',')\n```\n\nEquivalent to, in pure Arel:\n```ruby\nargs = [Arel::Table.new('posts')[:title], Arel::Nodes.build_quoted(',')]\nArel::Nodes::NamedFunction.new('string_agg', args)\n```\n\n### Simplified arel_table access\nYou can access to arel_table columns through #[] directly from the label.\n\nFor instance:\n```ruby\n(User[:id] == 1).to_sql # \"users\".\"id\" = 1\n```\n\nEquivalent to:\n```ruby\nUser.arel_table[:id].eq(1).to_sql\n```\n\n### Easy join using arel based on associations\n\n```ruby\nclass User\n  belongs_to :posts\nend\n\nUser.arel_join(:posts).to_sql # =\u003e 'INNER JOIN \"posts\" ON \"posts\".\"user_id\" = \"users\".\"id\"'\n\nUser.join(User.arel_join(:posts)) # =\u003e It works!\n```\n\nYou can also alias the table name:\n```ruby\nUser.arel_join(:posts, as: 'my_posts').to_sql # =\u003e INNER JOIN \"posts\" \"my_posts\" ON \"my_posts\".\"user_id\" = \"users\".\"id\"\n```\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\nAbout Monade\n----------------\n\n![monade](https://monade.io/wp-content/uploads/2021/06/monadelogo.png)\n\narel_ext is maintained by [mònade srl](https://monade.io/en/home-en/).\n\nWe \u003c3 open source software. [Contact us](https://monade.io/en/contact-us/) for your next project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Farel_ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonade%2Farel_ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonade%2Farel_ext/lists"}