Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First I would recommend start separating your Rails concepts from Ember. MVC means different things both in Ember and Rails, as Rails developer I also try to look for analogies and sometimes can get confusing (I'm working on a simple community guide for Rails devs into Ember <a href="https://github.com/abuiles/ember-rails-style-guide" rel="nofollow">https://github.com/abuiles/ember-rails-style-guide</a>)</p> <p>In Ember, the way to keep those "semantic methods" is done with Routes.</p> <p>In your case you'd have the OrdersIndexRoute, OrdersNewRoute, OrdersEditRoute (think of each of this ones as the "actions" in Rails) where</p> <p>OrdersIndexRoute = index action, you will need to setup all your orders models to be listed. It will look something like</p> <pre><code>App.OrdersIndexRoute = Ember.Route.Extend({ model: function(){ return Order.all; // If you are using ember-data this would be different, just supposing Orders.all returns all your orders models. } }); </code></pre> <p>OrdersNewRoute = new action, you will need to setup a <code>new</code> object which will be bound to the form and then submitted to your server.</p> <pre><code>App.OrdersNewRoute = Ember.Route.Extend({ model: function(params){ return Order.new() // returns a new instance of your model }, actions: { // this means that you would have something in your template like &lt;button {{action this}}&gt;... save: function(model){ model.save() } } }); </code></pre> <p>OrdersEditRoute = edit action, the <code>model</code> here would be the one that you want to edit.</p> <pre><code>App.OrdersEditRoute = Ember.Route.Extend({ model: function(params){ return Order.find(params.id) }, actions: { save: function(model){ model.save() } } }); </code></pre> <p>When you have this kind of doubt, feel free to jump into #emberjs in IRC, lots of smart and helpful fools there, willing to give you a hand when need it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload