Code Monkey home page Code Monkey logo

Comments (8)

connorshea avatar connorshea commented on July 26, 2024

Here's another fun one:

https://github.com/rails/rails/blob/96289cfb9b6aeb8f1a917f892148fd47f2f2049a/activerecord/lib/active_record/autosave_association.rb#L180

from sorbet-rails.

connorshea avatar connorshea commented on July 26, 2024

And there are also _ids getters and setters:

https://github.com/rails/rails/blob/b343beba03722672b9bb827f8ce29c7c1c216406/activerecord/lib/active_record/associations/builder/collection_association.rb#L55

module Game::GeneratedAssociationMethods
  def game_genre_ids(); end

  def game_genre_ids=(ids); end

  def game_platform_ids(); end

  def game_platform_ids=(ids); end

  def game_publisher_ids(); end

  def game_publisher_ids=(ids); end

  def game_purchase_ids(); end

  def game_purchase_ids=(ids); end
end

from sorbet-rails.

connorshea avatar connorshea commented on July 26, 2024

And reload_:

module Game::GeneratedAssociationMethods
  def reload_cover_attachment(); end

  def reload_cover_blob(); end

  def reload_pg_search_document(); end

  def reload_series(); end
end

https://github.com/rails/rails/blob/fc35da76e93f8a5d5ace595b4819e19cc0512edd/activerecord/lib/active_record/associations/builder/singular_association.rb#L19

As well as build_/create_:

module Game::GeneratedAssociationMethods
  def build_cover_attachment(*args, &block); end

  def build_pg_search_document(*args, &block); end

  def build_series(*args, &block); end

  def create_cover_attachment(*args, &block); end

  def create_cover_attachment!(*args, &block); end

  def create_pg_search_document(*args, &block); end

  def create_pg_search_document!(*args, &block); end

  def create_series(*args, &block); end

  def create_series!(*args, &block); end
end

https://github.com/rails/rails/blob/fc35da76e93f8a5d5ace595b4819e19cc0512edd/activerecord/lib/active_record/associations/builder/singular_association.rb#L28-L38

from sorbet-rails.

manhhung741 avatar manhhung741 commented on July 26, 2024

Since they aren't really used, there is little value to generate them, except to clean up hidden.rbi file. If you'd like to clean these up properly, feel free to contribute a plugin that generate the methods, but we don't add the plugin to the default list.

from sorbet-rails.

connorshea avatar connorshea commented on July 26, 2024

I've created a working plugin (although everything is essentially untyped): https://github.com/connorshea/VideoGameList/blob/9c9f1d0d1fb2394103fad05b77295007c0a7c2ae/lib/cursed_rbi_plugin.rb

It removed a little over 5k lines out of my 35k line hidden.rbi :)

@manhhung741 do you still want this? :) Should I rename it from 'CursedRbiPlugin'? And how should the user enable its usage?

from sorbet-rails.

manhhung741 avatar manhhung741 commented on July 26, 2024

from sorbet-rails.

manhhung741 avatar manhhung741 commented on July 26, 2024

from sorbet-rails.

connorshea avatar connorshea commented on July 26, 2024

Something to do with metaprogramming, probably. Maybe MetaprogrammingGarageSalePlugin? :P

from sorbet-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.