Comments (3)
Sorry for my super late reply, I've had some time to be able to look back into this for our application.
I think at the time I didn't fully understand the problem I was facing. Looking at this again I need to be able to saved unknown attributes, which is already an issue on this project. I'm going to close this issue, thanks again for your response!
from store_model.
Hmmm on taking a second look I'm not sure my initial diagnosis was the cause of the problem...trying to figure it out now.
from store_model.
Hi @evanshabsove, thanks for reaching out!
If I understand the problem correctly, you want to store one or more customization (of many more) in the same JSON column. You've mentioned, that you don't want to create a class for each possible customization, but would inline syntax solve your problem? (it's easy to add):
class Configuration
include StoreModel::Model
attribute :supplier do
attribute :title, :string
end
end
instead of
class Supplier
include StoreModel::Model
attribute :title, :string
end
class Configuration
include StoreModel::Model
attribute :supplier, Supplier.to_type
end
As for the part about raised error, I guess the reason is different from empty attributes (because you don't have any validations), maybe it's caused by the method_missing
trick. I'd be happy to assist if you share more details or reproduction example.
from store_model.
Related Issues (20)
- Is it possible to assign an attribute with the type ':symbol'? HOT 4
- Defaults are loaded every time HOT 1
- How to persist default attributes? HOT 1
- Presence validation fails if value is false HOT 2
- How to attach active storage files? HOT 3
- Array of array support HOT 3
- One of depending on another model's column HOT 4
- Validate any Hash HOT 1
- Encrypt attributes HOT 2
- Aliasing an attribute HOT 1
- GraphQL input type fails to cast HOT 4
- ArgumentError: wrong number of arguments (given 1, expected 0) in random model HOT 3
- Assignment Doesn't work in OneOf case HOT 3
- Delegation of `fetch` to `attributes` causes issues HOT 2
- NameError: uninitialized constant StoreModel::Types::ArrayType HOT 3
- Default values for attributes when retrieving the store model HOT 1
- Decoding Custom Types HOT 1
- Allow an option to disallow "UnknownAttributes" behavior HOT 1
- ActiveRecord validation contexts don't propagate HOT 1
- Override methods HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store_model.