16
Happiness with Ruby on Rails www.new-bamboo.co.uk

Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Happiness with Ruby on Rails

www.new-bamboo.co.uk

Page 2: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

What is it?

• Nothing new... Well sort of.

• MVC

• Convention over configuration

• Ruby front to back

Page 3: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

The three A’s

• Activerecord

• Activesupport

• Actionpack

Page 4: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Activerecord

• Rich models

• No XML configuration files

• DSL to describe model relationships

• DSL to describe validation

Page 5: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify
Page 6: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify
Page 7: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

REST

• URI’s become resources http://www.new-bamboo.co.uk/users/234

• POST - Create

• PUT - Update

• DELETE - Destroy

• GET - Show/Edit/Index

Page 8: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Routes

/users/users/2

/users/2;edit/users/2/account

Page 9: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Routes

• users_url (GET) - Index

• user_url(id) (GET) - Show

• user_url(id) (DELETE) - Destroy

• user_url(id) (PUT) - Update

Page 10: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

So what?

Page 11: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

RJS

Page 12: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Beautiful testing

Page 13: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

Test::Unit

Page 14: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

RSpec

Page 15: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

So what’s the difference?

• Vocabulary

• Hopefully a transition in thinking

Page 16: Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end Auction new . attributes AuctionSpecHelper . val . stub ! ( : save ! do specify

It’s Ruby that makes me happy:)