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.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.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.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 = 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
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
= 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
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
# Taken from https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec), | |
# with some minor changes | |
module ControllerMacros | |
def login_admin(&proc) | |
before(:each) do | |
@request.env["devise.mapping"] = Devise.mappings[:admin] | |
admin_user = proc ? instance_eval(&proc): FactoryGirl.create(:admin_user) | |
sign_in admin_user | |
end |
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/routes/users/index.js | |
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions: { | |
remove: function(model) { | |
if(confirm('Are you sure?')) { | |
model.destroyRecord(); | |
} |