Skip to content

Defining attrs on runtime? #233

Description

@mbajur

I was thinking - would that be possible to somehow define attr_jsons on record on runtime rather than defining them in advance on model definition?

Something like:

record = MyModel.last
record.define_attr_json :my_string, :string
record.my_string #=> "Hello"

In my current setup, every customer (tenant) of my app can define his own set of custom fields for "Project" model therefore i can't have them defined globally, i have to be able to re-load whatever custom fields tenant has defined on every target record load.

Also, i'm totally okay with some #send(:private_method) hacking or any sort of hacking to make that work :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions