{"id":14110036,"url":"https://github.com/iftheshoefritz/solargraph-rails","last_synced_at":"2025-08-01T09:32:47.917Z","repository":{"id":38078287,"uuid":"309577327","full_name":"iftheshoefritz/solargraph-rails","owner":"iftheshoefritz","description":"Solargraph plugin to add awareness of Rails-specific code","archived":false,"fork":false,"pushed_at":"2024-06-23T19:33:15.000Z","size":8116,"stargazers_count":322,"open_issues_count":25,"forks_count":30,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-11-17T14:14:15.300Z","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/iftheshoefritz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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,"publiccode":null,"codemeta":null}},"created_at":"2020-11-03T04:52:16.000Z","updated_at":"2024-11-15T13:43:07.000Z","dependencies_parsed_at":"2024-06-18T16:51:40.076Z","dependency_job_id":"fd8a214f-4dee-43a8-b44c-0b44ab8dc531","html_url":"https://github.com/iftheshoefritz/solargraph-rails","commit_stats":{"total_commits":135,"total_committers":11,"mean_commits":"12.272727272727273","dds":0.3481481481481481,"last_synced_commit":"f671f1c9aa036683bcc47769a3d2c48391df596c"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iftheshoefritz%2Fsolargraph-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iftheshoefritz%2Fsolargraph-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iftheshoefritz%2Fsolargraph-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iftheshoefritz%2Fsolargraph-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iftheshoefritz","download_url":"https://codeload.github.com/iftheshoefritz/solargraph-rails/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228360562,"owners_count":17907937,"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-08-14T10:02:37.792Z","updated_at":"2025-08-01T09:32:47.905Z","avatar_url":"https://github.com/iftheshoefritz.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Solargraph::Rails - Help solargraph with Rails\n\n## Models\nConsider pair of typical Rails models like this:\n\n```sh\nrails g model Author lastname:string firstnames:string\nrails g model Book title:string isbn:string author:belongs_to\n```\n\n```ruby\nclass Author \u003c ApplicationRecord\n  has_many :books\n\n  def sortable_name\n    \"#{lastname}, #{firstnames}\"\n  end\nend\n\nclass Book \u003c ApplicationRecord\n  belongs_to :author\n\n  def label\n    [author.sortable_name, title, isbn].join(\"\\n\")\n  end\nend\n```\n\nThe various Ruby intellisense tools are ok at knowing that there are `Book` and `Author` constants, and some (including Solargraph) are aware that objects like `Book.new` have a `.label` method. But what about those \"magical\" dynamic methods that ActiveRecord creates like `.title`, or `.author`?\n\nSince these attributes are only created at runtime, a simple static analysis of the `Book` class alone can't identify them. Your editor has no idea that these attributes exist, but they're amongst the most common things that you will work with in any Rails app.\n\nThat's where this plugin for Solargraph comes in: it understands db/schema.rb and any comments from the annotate\\_models gem for models, and also supplies key annotations and Rails-specific context on top of what Solargraph pulls via YARD and RBS.   As a result, you have access to database attributes:\n\n ![Go to attribute schema definition](assets/sg_rails_1_0_go_to_attribute_definition.gif)\n\n ... and ActiveRecord finders:\n\n ![ActiveRecord method support](assets/sg_rails_1_0_activerecord_support.gif)\n\n ... and associations:\n\n ![Association support](assets/sg_rails_1_0_association_completion.gif)\n\n ... and routes file syntax:\n\n ![Routes file support](assets/sg_rails_1_0_routes_support.gif)\n\nand more!\n\n## Installation\n\n###  Install `solargraph` and `solargraph-rails`\n\nIf you add them to your Gemfile, you'll have to tell your IDE plugin to use bundler to load the right version of solargraph.\n\n### Import Rails RBS types\n\nUse [gem\\_rbs\\_collection](https://github.com/ruby/gem_rbs_collection)\nto install RBS types for Rails:\n\n```sh\nrbs collection init\nrbs collection install\n```\n\n### Add `solargraph-rails` to your `.solargraph.yml`\n\n(if you don't have a `.solargraph.yml` in your project root, you can run `solargraph config` to add one)\n\n```\nplugins:\n  - solargraph-rails\n```\n\n### Build YARD docs\nIn the project root, run `yard gems`.\n\n## Contributing\nBug reports and pull requests are welcome on GitHub at https://github.com/iftheshoefritz/solargraph_rails.\n\n1. create fork and clone the repo\n\n2. install gem deps `bundle install`\n\n3. install dummy rails app deps:\n\n```\ncd spec/rails7 \u0026\u0026 bundle install \u0026\u0026 rbs collection init \u0026\u0026 rbs collection install \u0026\u0026 cd ../../\ncd spec/rails8 \u0026\u0026 bundle install \u0026\u0026 rbs collection init \u0026\u0026 rbs collection install \u0026\u0026 cd ../../\n```\n\n4. now tests should pass locally and you can try different changes\n\n5. submit PR\n\nSee [DEVELOPMENT.md](./DEVELOPMENT.md) for more information\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiftheshoefritz%2Fsolargraph-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiftheshoefritz%2Fsolargraph-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiftheshoefritz%2Fsolargraph-rails/lists"}