indexiatech / ember-forms

Smart, Intuitive forms for Ember.js styled with Bootstrap, Multi layouts and Validation support.
http://indexiatech.github.io/ember-forms
Apache License 2.0
218 stars 45 forks source link

Ember validations api changed? #21

Closed millisami closed 10 years ago

millisami commented 10 years ago

Hi, Looking at the example http://ember-addons.github.io/ember-forms/#/quickexample, you've put the ember-validation in the model. But the README of https://github.com/dockyard/ember-validations#usage, validation rule is added in controller instead of model.

So, does this work?

mblackritter commented 10 years ago

Yes, it does work on both, controller and model level.

See https://github.com/ember-addons/ember-forms/issues/18

I think the validation documentation isn't complete on this, or they expect that you're familiar with how all of Ember's magic works and so it's obvious for you that both works.

If someone wants to shed more technical light on why/how this works, you're welcome. ;)

Coming from less magical backgrounds, I had quite a few "wild days" with all of Ember's and Laravel's magic.

I updated this JS Bin to use the latest (http://builds.dockyard.com.s3.amazonaws.com/ember-validations/release/ember-validations.js) and it works. :)

asaf commented 10 years ago

The form control expects an Ember object, both Ember-Data models & Ember Controllers extends from Ember.Object, so it doesn't really matter for the forms if you pass a model or a controller.