This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pt-BR: | |
| enumerize: | |
| defaults: | |
| state: | |
| ac: Acre | |
| al: Alagoas | |
| ap: Amapá | |
| am: Amazonas | |
| ba: Bahia | |
| ce: Ceará |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| = simple_form_for([@topic], remote: true, data: { "rerender-inside-modal" => true }) do |f| | |
| = f.input :name | |
| = f.input :content | |
| = f.submit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| h = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc) } # => {} | |
| h[:a] = 1 # => 1 | |
| h[:b][:c] = 2 # => 2 | |
| h[:c][:d] = 3 # => 3 | |
| h # => {:a=>1, :b=>{:c=>2}, :c=>{:d=>3}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App = Ember.Application.create(); | |
| App.Router.map(function() { | |
| // put your routes here | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| model: function() { | |
| return "Hello world"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.IndexRoute = Ember.Route.extend({ | |
| beforeModel: function() { | |
| console.log("beforeModel"); | |
| }, | |
| model: function() { | |
| console.log("model") | |
| }, | |
| afterModel: function() { | |
| console.log("afterModel"); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.IndexController = Ember.Controller.extend({ | |
| say: function(msg) { | |
| console.log("Hello " + msg); | |
| } | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| setupController: function(controller) { | |
| controller.say("world"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.FooController = Ember.Controller.extend({ | |
| say: function(msg) { | |
| console.log("Hello " + msg); | |
| } | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| controllerName: 'foo', | |
| setupController: function(controller) { | |
| controller.say("world"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.IndexRoute = Ember.Route.extend({ | |
| renderTemplate: function() { | |
| this.render(); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App = Ember.Application.create(); | |
| var html = $("#myTemplate").remove().html(); | |
| var template = Ember.Handlebars.compile(html); | |
| var model = "Click here"; | |
| var controller = { model: model }; | |
| var view = Ember.View.create({ | |
| template: template, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.IndexRoute = Ember.Route.extend({ | |
| viewName: "foo" | |
| }); | |
| App.FooView = Ember.View.extend({ | |
| didInsertElement: function() { | |
| console.log("FooView") | |
| } | |
| }); |