Como programar un blog REST

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Como programar un blog REST - Presentation Transcript

    1. Cómo programar un blog REST Javier Vidal Postigo http://javiervidal.net/ Conferencia Rails 2007
    2. ¿Qué es Rails?
    3. framework ruby para desarrollar aplicaciones web con acceso a base de datos
    4. framework ruby para desarrollar aplicaciones web con acceso a base de datos convención mejor que configuración
    5. ¿Qué es MVC?
    6. MVC en Rails DB Enrutador Vista Modelo Controlador
    7. MVC en Rails DB Enrutador Vista Modelo Controlador
    8. MVC en Rails DB Enrutador Vista Modelo Controlador
    9. MVC en Rails DB Enrutador Vista Modelo Controlador
    10. MVC en Rails DB Enrutador Vista Modelo Controlador
    11. MVC en Rails DB Enrutador Vista Modelo Controlador
    12. MVC en Rails DB Enrutador Vista Modelo Controlador
      • http://server/controller/action/id
      • http://server/posts/show/1
    13. ¿Qué es REST?
    14. REST => “Representational State Transfer”
      • modelo de arquitectura de aplicaciones
      • las aplicaciones gestionan recursos
      • las operaciones son los verbos HTTP
    15. REST => “Representational State Transfer”
      • modelo de arquitectura de aplicaciones
      • las aplicaciones gestionan recursos
      • las operaciones son los verbos HTTP
      recurso URI instancia de modelo
    16. REST => “Representational State Transfer”
      • modelo de arquitectura de aplicaciones
      • las aplicaciones gestionan recursos
      • las operaciones son los verbos HTTP
      recurso URI instancia de modelo operación verbo HTTP acción del controlador
    17. Create Read Update Delete
    18. Create Read Update Delete insert find update delete
    19. Create Read Update Delete insert find update delete POST GET UPDATE DELETE
    20. Create Read Update Delete insert find update delete POST GET UPDATE DELETE create show update destroy
      • POST
      • GET
      • PUT
      • DELETE
      • /posts
      • /posts/1
      • /posts/1
      • /posts/1
      • # GET /posts/1
      • def show ... end
      • # POST /posts
      • def create ... end
      • # PUT /posts/1
      • def update ... end
      • # DELETE /posts/1
      • def destroy ... end
      • end
      class PostsController < ApplicationController
      • # GET /posts/1
      • def show ... end
      • # POST /posts
      • def create ... end
      • # PUT /posts/1
      • def update ... end
      • # DELETE /posts/1
      • def destroy ... end
      • end
      • link_to &quot;#{post.title}&quot; , post_url(post)
      class PostsController < ApplicationController
      • # GET /posts/1
      • def show ... end
      • # POST /posts
      • def create ... end
      • # PUT /posts/1
      • def update ... end
      • # DELETE /posts/1
      • def destroy ... end
      • end
      • form_for( :post ,
      • :url => posts_path) do |f|
      • f.text_field :title
      • f.text_area :body
      • submit_tag &quot;Create&quot;
      • end
      class PostsController < ApplicationController
      • # GET /posts/1
      • def show ... end
      • # POST /posts
      • def create ... end
      • # PUT /posts/1
      • def update ... end
      • # DELETE /posts/1
      • def destroy ... end
      • end
      • form_for( :post ,
      • :url => post_path( @post ),
      • :html => {:method => :put }) do |f|
      • f.text_field :title
      • f.text_area :body
      • submit_tag &quot;Update&quot;
      • end
      class PostsController < ApplicationController
      • # GET /posts/1
      • def show ... end
      • # POST /posts
      • def create ... end
      • # PUT /posts/1
      • def update ... end
      • # DELETE /posts/1
      • def destroy ... end
      • end
      • link_to 'Borrar' , post_path(post),
      • :method => :delete
      class PostsController < ApplicationController
    21. Todavía hay más
    22. class PostsController < ApplicationController # GET /posts def index ... end # GET /posts/1 def show ... end # GET /posts/new def new ... end # GET /posts/1/edit def edit ... end # POST /posts def create ... end # PUT /posts/1 def update ... end # DELETE /posts/1 def destroy ... end end
    23. class PostsController < ApplicationController # GET /posts def index ... end # GET /posts/1 def show ... end # GET /posts/new def new ... end # GET /posts/1/edit def edit ... end # POST /posts def create ... end # PUT /posts/1 def update ... end # DELETE /posts/1 def destroy ... end end
    24. class PostsController < ApplicationController # GET /posts def index ... end # GET /posts/1 def show ... end # GET /posts/new def new ... end # GET /posts/1/edit def edit ... end # POST /posts def create ... end # PUT /posts/1 def update ... end # DELETE /posts/1 def destroy ... end end
    25. class PostsController < ApplicationController # GET /posts def index ... end # GET /posts/1 def show ... end # GET /posts/new def new ... end # GET /posts/1/edit def edit ... end # POST /posts def create ... end # PUT /posts/1 def update ... end # DELETE /posts/1 def destroy ... end end
      • GET
      • GET
      • GET
      • GET
      • POST
      • PUT
      • DELETE
      • /posts
      • /posts/1
      • /posts/new
      • /posts/1/edit
      • /posts
      • /posts/1
      • /posts/1
      • index
      • show
      • new
      • edit
      • create
      • update
      • destroy
      • posts_path
      • post_path(1)
      • new_post_path
      • edit_post_path(1)
      • posts_path
      • post_path(1)
      • post_path(1)
      • class PostsController < ApplicationController
      • def add_comment ... end
      • end
      • class PostsController < ApplicationController
      • def add_comment ... end
      • end
      • class CommentsController < ApplicationController
      • def assign_to_post ... end
      • end
      • class PostsController < ApplicationController
      • def add_comment ... end
      • end
      • class CommentsController < ApplicationController
      • def assign_to_post ... end
      • end
        • recursos anidados
      • class PostsController < ApplicationController
      • def add_comment ... end
      • end
      • class CommentsController < ApplicationController
      • def assign_to_post ... end
      • end
        • recursos anidados
        • añadiendo un nuevo recurso “membership”
      • class Post < ActiveRecord::Base
      • has_many :memberships
      • has_many :comments , :through => :memberships
      • end
      • class Comment < ActiveRecord::Base
      • has_many :memberships
      • end
      • class Membership < ActiveRecord::Base
      • belongs_to :comment
      • belongs_to :post
      • end
      post membership comment
    26. RailsConf '06: World of Resources David Heinemeier Hansson http://media.rubyonrails.org/presentations/worldofresources.pdf Desarrollo REST con Rails Ralf Wirdemann y Thomas Baustert (traducción de Juán Lupión) http://www.b-simple.de/download/restful_rails_es.pdf RESTful Web Services Leonard Richardson y Sam Ruby http://www.amazon.com/ Referencias
    27. http://javiervidal.net/ [email_address]

    + zanaguarazanaguara, 2 years ago

    custom

    1774 views, 0 favs, 2 embeds more stats

    Como programar un blog REST

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1774
      • 1757 on SlideShare
      • 17 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 17
    Most viewed embeds
    • 15 views on http://javiervidal.net
    • 2 views on http://wp_javiervidal

    more

    All embeds
    • 15 views on http://javiervidal.net
    • 2 views on http://wp_javiervidal

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories