Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end...
Transcript of Happiness with Ruby on Rails · "An auction that we want to remove" context do setup @auction end...
![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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/1.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/2.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/3.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/4.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/5.jpg)
![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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/6.jpg)
![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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/7.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/8.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/9.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/10.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/11.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/12.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/13.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/14.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/15.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022081615/5fd43f376d41e177ff30e416/html5/thumbnails/16.jpg)
It’s Ruby that makes me happy:)