guillermo{at}guerreroibarra{dot}com
Follow me on github: https://github.com/ryanfox1985
March 16th, 2016
Components: [Price ~ 80€]
$ rails new rupibox
$ cd rupibox
$ rails g scaffold Pin name:string pin_pi:integer value:boolean
Prefix Verb URI Pattern Controller#Action
pins GET /pins(.:format) pins#index
POST /pins(.:format) pins#create
new_pin GET /pins/new(.:format) pins#new
edit_pin GET /pins/:id/edit(.:format) pins#edit
pin GET /pins/:id(.:format) pins#show
PATCH /pins/:id(.:format) pins#update
PUT /pins/:id(.:format) pins#update
DELETE /pins/:id(.:format) pins#destroy
$ mkdir angular; cd angular
$ yo webapp
app.factory("Pin", function ($resource, ENV) {
return $resource(ENV.apiEndpoint + "/pins/:id.json", {id: "@id"},
{
'create': {method: 'POST'},
'index': {method: 'GET', isArray: true},
'show': {method: 'GET', isArray: false},
'update': {method: 'PUT'},
'destroy': {method: 'DELETE'}
}
);
});
// Query all pins
$scope.pins = Pin.query();
// Update value
Pin.update({id: pin.id}, {pin: pin});
$ bower install BOWER_MODULE --save
$ bower install bootstrap-switch --save
$ bower install angular-xeditable --save