Rails2 Pr

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

    2 Favorites

    Rails2 Pr - Presentation Transcript

    1. • Rails 2.0 Preview Release • 1.2.4 • 2.0 •
    2. Behold, behold, Rails 2.0 is almost here. But before we can slap on the final stamp, we’re going to pass through a couple of trial release phases. The first is this preview release, which allows you to sample the goodies in their almost finished state. • 2.0 • • • by DHH
    3. We might change a few things or add something else, but by and large, this is how Rails 2.0 is going to look and feel. After this release have had a chance to be tried out, we’re going to move to a release candidate or two (or three, depending on how many we need). Then, the final release. • 2.0 • •
    4. Before the release of 2.0, we’re also going to be putting out 1.2.4, which will include a variety of bug fixes and the last deprecation warnings to get you ready for upgrading an existing application to 2.0 standards. • 2.0 1.2.4 • • • 2.0 deprecation warning
    5. Enough about process. Let me tell you a little bit about what’s new in Rails 2.0: • Rails 2.0
    6. Action Pack: Resources • • namespace • rake routes routes •
    7. Action Pack: Resources map.resources( :users, :has_many => :friends ) config/routes
    8. Action Pack: Multiview # should go in config/initializers/mime_types.rb Mime.register_alias \"text/html\", :iphone • respond_to class ApplicationController < ActionController::Base before_filter :adjust_format_for_iphone • show.rhtml private show.html.erb def adjust_format_for_iphone if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"][/(iPhone|iPod)/] • request.format = :iphone 3.0 show.rhtml deprecated end end • show.csv.erb text/csv CSV end class PostsController < ApplicationController def index respond_to do |format| • − format.html # renders index.html.erb format.iphone # renders index.iphone.erb end end end
    9. Action Pack: Record identification # person is a Person object, which by convention will # be mapped to person_url for lookup redirect_to(person) link_to(person.name, person) form_for(person) • • URL • URL • :controller=>:user,:action=>:index • form_to(person) person (PUT) (POST) form action
    10. Action Pack: HTTP Loving class PostsController < ApplicationController USER_NAME, PASSWORD = \"dhh\", \"secret\" before_filter :authenticate, :except => [ :index ] • Basic ( ) def index render :text => \"Everyone can see me!\" end • javascript_include_tag def edit render :text => \"I'm only accessible if you know (:all,:cache=>true) the password\" end private public/javascripts/all.js def authenticate authenticate_or_request_with_http_basic do | user_name, password| user_name == USER_NAME && password == PASSWORD end end end
    11. Action Pack: Security • form Ajax CSRF • XSS TextHelper#sanitize • HTTP only cookies
    12. Action Pack: Exception handling class PostsController < ApplicationController rescue_from User::NotAuthorized, :with => :deny_access protected def deny_access ... end end • rescue_from
    13. Action Pack: Miscellaneous • atom RSS # index.atom.builder: atom_feed do |feed| feed.title(\"My great blog!\") feed.updated((@posts.first.created_at)) for post in @posts • feed.entry(post) do |entry| entry.title(post.title) entry.content(post.body, :type => 'html') • asset entry.author do |author| author.name(\"DHH\") • end end • end in_place_editor end auto_complete_for Rails
    14. Active Record: Performance • Query • fixture 50-100%
    15. Active Record: Sexy migrations create_table :people do |t| t.column, \"account_id\", :integer t.column, \"first_name\", :string, :null => false t.column, \"last_name\", :string, :null => false t.column, \"description\", :text t.column, \"created_at\", :datetime t.column, \"updated_at\", :datetime end create_table :people do |t| t.integer :account_id t.string :first_name, :last_name, :null => false t.text :description t.timestamps end
    16. Active Record: XML in, JSON out • XML JSON Person.new.from_xml(“David“) person.to_json
    17. Active Record: Shedding some weight acts_as_XYZ • ActiveRecord acts_as_XYZ Rails ./script/plugin install acts_as_list
    18. Active Record: Shedding some weight DB • DB gem • activerecord-XYZ-adapter
    19. Active Record: with_scope with a dash of syntactic vinegar • .with_scope public protected • • • .send(:with_scope) with_scope
    20. ActionWebService out, ActiveResource in • SOAP vs REST • SOAP • ActionWebService gem • ActiveResource • ActiveResource ActiveRecord
    21. ActiveSupport • • Array#rand • Hash#except • Date • assert_defference •
    22. Action Mailer • • • assert_email
    23. Rails: The debugger is back • ruby-debug • --debugger -u • ./script/breakpointer
    24. Rails: Clean up your environment • inflections.rb • mime_types.rb mime type environment.rb config
    25. Rails: Easier plugin order • acts_as_list • environment.rb config.plugins = [ :acts_as_list, :all ]
    26. And hundreds upon hundreds of other improvements • CHANGELOG
    27. • • basic • with_scope •

    + xibbarxibbar, 2 years ago

    custom

    3285 views, 2 favs, 0 embeds more stats

    OSC2007-fall Rails2.0 Preview Release

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 3285
      • 3285 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 161
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

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

    Cancel

    Categories

    Tags