This file contains 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 = angular.module(‘AwesomeApp’, [‘ngResource’]). | |
.config [‘$routeProvider’, ($route) → | |
$route.when(‘/sessions’, { | |
controller: SessionCtrl, | |
templateUrl: ‘/app/templates/sessions/login.html’ | |
}) |
This file contains 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 is the variable that contains the module “AwesomeApp” | |
app.controller ‘SessionCtrl’, ($scope, $location, Session) → | |
$scope.login = → | |
Session.save $scope.session , (response) → | |
$location.path “/dashboard” |
This file contains 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 = angular.module(‘AwesomeApp’, [‘ngResource’]). | |
.config [‘$routeProvider’, ($route) → | |
$route.when(‘/sessions’, { | |
controller: ‘SessionCtrl’, # replace the controller function by the controller name | |
templateUrl: ‘/app/templates/sessions/login.html’ | |
}) |
This file contains 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
class Post < ActiveResource::Base | |
self.site = 'http://37s.sunrise.i:3000' | |
has_many :comments | |
end |
This file contains 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
class Comment < ActiveResource::Base | |
self.site = 'http://37s.sunrise.i:3000' | |
belongs_to :post | |
end |
This file contains 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
class User < ActiveResource::Base | |
self.site = 'http://37s.sunrise.i:3000' | |
validates_presence_of :login, :email | |
before_validation :ensure_login_has_a_value | |
after_destroy :log_user_deletion | |
protected | |
def ensure_login_has_a_value | |
unless login |
This file contains 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
# GET /posts.json delivers following response body: | |
# { | |
# posts: [ | |
# { | |
# title: "ActiveResource now has associations", | |
# body: "Lorem Ipsum" | |
# } | |
# {...} | |
# ] | |
# next_page: "/posts.json?page=2" |
This file contains 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
class Weather < ActiveResource::Base | |
include ActiveResource::Singleton | |
self.site = 'http://37s.sunrise.i:3000' | |
end |
This file contains 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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold |
This file contains 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
{"results":[{"id":"OEKHewM","name":"","image":"http://assets.p.rs.mystorey.com/uploads/social/large_square_8ee7e37e10d4595150a02a2007289537.jpg","thumb":"http://assets.p.rs.mystorey.com/uploads/social/square_8ee7e37e10d4595150a02a2007289537.jpg","user":"Zubin Mowlavi","slug":"zubin-mowlavi","blurb":"Great night out with friends and family.","places":[],"people":[],"things":[{"id":2725,"uuid":"472db705f5b1bc2bd58b0158f73d5682","name":"Kid Dangerous Grime C...","price":"$36.00","brand":"Kid Dangerous","color":"ffffff","image":"http://assets.p.rs.mystorey.com/uploads/things/grid_8cac653e9bcbbd1b6e4a65d56533a52f.jpg","preview":"http://assets.p.rs.mystorey.com/uploads/things/preview_8cac653e9bcbbd1b6e4a65d56533a52f.jpg","thumb":"http://assets.p.rs.mystorey.com/uploads/things/thumb_8cac653e9bcbbd1b6e4a65d56533a52f.jpg","a_category":"Men's Tops","category":"Men's Tops","category_id":96,"url":"/products/472db705f5b1bc2bd58b0158f73d5682?experience_code=OEKHewM","type":"things","outbound":"http://api.viglink.com/api/cl |