Giter VIP home page Giter VIP logo

activerecord-ejection_seat's People

Contributors

maxveldink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

activerecord-ejection_seat's Issues

Add `sorbet-schema` serializer

The mechanics of this library are very similar to another serializer in sorbet-schema, where an AR model is formatting converting to and from. We can ship a serializer implementation here to allow this behavior using the sorbet-schema infrastructure.

Add Tapioca compiler for models with `ejects_to` defined

When eject is called on an instance of an ActiveRecord model that defines ejects_to, Sorbet does not know the method exists. Further, we don't know what the return type should be, so we're forced to use the typed: false sigil.

Tapioca allows for custom compilers to generate RBIs for a project based on given conditions. We should add one for ejection_seat to give more type information.

Support association mapping to `T::Struct` fields

Right now, we only support simple mappings onto T::Struct. This is fine if you just need the id of a relation for a given model. What I'd love to do is have types like

module Types
  class User < T::Struct
    const :name, String
    const :location, Location
  end

  class Location < T::Struct
    const :name, String
  end
end

and be able to eject a user, look up the location information via the association and also eject the location onto this type.

Caveat - We need to be careful of circular requires here. Something will need to prevent trying to create infinite structs if two types reference each other. We should not create any associations if the type of that association is the ejection target of the receiver.

Allow for manual requiring `Ejectable` module in `ActiveRecord`

Currently, when you add activerecord-ejection_seat to your Gemfile, it will auto-require the Ejectable module in ActiveRecord::Base to make it available to all models automatically. There probably should be an option for auto-requiring (current behavior) or manually requiring. This would allow a company to have an explicit extend Ejectable in their ApplicationRecord or only extend Ejectable on the models they want to have that functionality for.

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.