Rochester on Rails: Introduction to Rails

download Rochester on Rails: Introduction to Rails

of 43

  • date post

    06-May-2015
  • Category

    Technology

  • view

    1.297
  • download

    4

Embed Size (px)

description

An entry-level introduction to Rails (circa 1.13) I gave at Rochester on Rails. Covers the history, reasons you may use it in a project, and basic architecture.

Transcript of Rochester on Rails: Introduction to Rails

  • 1.Jason Morrison January 19, 2006 Rochester on Rails Ruby on Rails Sustainable Productivity for Web Application Development

2. History 3. July 2004 David Heineimeier Hansson 4. Extracted from Basecamp 5. 6. 37signals 7. 8. Hundreds of contributors Thousands of revisions, tickets, and patches 9. Rails 1.0December 13, 2005 10. 11. What is Rails? 12. Full Stack 13. Web Application Framework 14. Its all Ruby! 15. (okay, except one file) 16. (here it is) database.yml development: adapter: sqlite dbfile: db/dev.db test: adapter: sqlite dbfile: db/test.db production: adapter: sqlite dbfile: db/prod.db 17. Everything else is Ruby! 18. ActiveRecord 19. ActionPack 20. ERb views 21. ActionWebService 22. ActionMailer 23. Unit Testing 24. AJAX Helpers 25. Key Concepts 26. DRY: Dont Repeat Yourself 27. + 28. Convention over configuration 29. = 30. Less code! 31. Order.hbm.xml 01 02 06 08 09 10 12 13 14 15 18 19 32. Order.java 01 public class Order { 02private Set items; 03private String name; 04private Long id; 0506public Long getId() { return id;} 07public void setId(Long id) { this.id = id;} 08public Set getItems() { return items;} 09public void setItems(Set items) { this.items = items; } 10public String getName() { return name; } 11public void setName(String name) { this.name = name; } 12 } 33. order.rb 01 class Order < ActiveRecord::Base 02 has_many :items 03 end 34. Rails is expressive 35. class Project < ActiveRecord::Base belongs_to :portfolio has_one :project_manager has_many :milestones has_and_belongs_to_many :categories validates_presence_of :name, :description validates_acceptance_of :non_disclosure_agreement validates_uniqueness_of :key end 36. #Were slashing prices, all books are now half off! Product.find( :all, :conditions => kind=book ) do |product| product.price *= 0.5 product.save end 37. Increases Programmer Rails increases programmer 38. Increases Programmer Rails increases programmerhappiness! 39. How does it fit together? 40. Model View Controller 41. Model View Controller ActiveRecord ActionPack } } 42. 43. Ready, set, code!