Comments (9)
Oh! The validation probably needs too be on event-attenndance! I'll try that
On Thu, Apr 21, 2016, 11:04 AM Esteban Arango Medina <
[email protected]> wrote:
@NullVoxPopuli https://github.com/NullVoxPopuli Looking at your code.
Seems like the attendance model doesn't have the level relation, are you
using there an attendance or an event-attendance (which is the one with
the realtion) ?
The validation looks good and should be working as you have it there.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#32 (comment)
from ember-model-validator.
I have this currently:
custom: {
message: 'Level is required for the selected ticket.',
// value may be a promise here
// so we need to see if we can access the
// id property on it
validation(key, value, model){
let requiresLevel = model.get('package.requiresTrack');
debugger;
if (requiresLevel){
// value is undefined, and level is a promise
return Ember.isPresent(model.get('level'));
}
return true;
}
}
from ember-model-validator.
@NullVoxPopuli You need to add that validation directly on the relation. Could you show me your entire model.
from ember-model-validator.
here is the model: https://github.com/NullVoxPopuli/aeonvera-ui/blob/master/app/models/attendance.js#L66
here is how I'm validating it: https://github.com/NullVoxPopuli/aeonvera-ui/blob/master/app/services/order-cart.js#L153
(I'm just calling validate()
on the attendance
)
from ember-model-validator.
@NullVoxPopuli Looking at your code. Seems like the attendance
model doesn't have the level
relation, are you using there an attendance
or an event-attendance
(which is the one with the realtion) ?
The validation looks good and should be working as you have it there.
from ember-model-validator.
@NullVoxPopuli Let me know if that works so I can close this issue. Thank you.
from ember-model-validator.
Ok, so I finally move the level validation to the event-attendance:
So maybe it's just a logic thing. Cause if I change my isPresent check to be on model.get('level.id')
, it works just fine ('throws' a validation error via validate()
)
from ember-model-validator.
Though, I think it would be great to have bulit in if:
keys on the relationship validators, like, I would like to do:
validations: {
level: {
presence: true,
if: 'model.package.requiresTrack'
}
}
from ember-model-validator.
also, it appears validations get extended from superclass to subclass :-\ I'll open that as a seperate issue
from ember-model-validator.
Related Issues (20)
- An in-range update of ember-cli-htmlbars is breaking the build 🚨 HOT 1
- An in-range update of ember-cli-inject-live-reload is breaking the build 🚨 HOT 2
- An in-range update of sass is breaking the build 🚨 HOT 10
- An in-range update of ember-ajax is breaking the build 🚨 HOT 1
- An in-range update of eslint-plugin-ember is breaking the build 🚨 HOT 2
- An in-range update of ember-template-lint is breaking the build 🚨 HOT 12
- An in-range update of ember-cli-htmlbars-inline-precompile is breaking the build 🚨 HOT 1
- An in-range update of ember-cli-babel is breaking the build 🚨 HOT 9
- An in-range update of ember-cli is breaking the build 🚨 HOT 2
- An in-range update of ember-cli-htmlbars is breaking the build 🚨 HOT 1
- When do you plan to make next release? HOT 2
- `errors` is a proxy object with no length HOT 2
- model.validate() causes error HOT 6
- ember-global deprecation warning on 3.28 HOT 2
- Potential Feature: Validate from template function HOT 1
- InternalModel removed in ember 4.6 HOT 1
- not validate octane relations HOT 1
- Error with [email protected] and ember 4.6+ HOT 1
- Error with ember model fragment while validating with ember-model-validator
- Add support to validate nested objects
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 ember-model-validator.