[ANN] Rails 0.5.5: Windows, WEBrick, lots!

Discussion in 'Ruby' started by David Heinemeier Hansson, Jul 29, 2004.

  1. What's new in Rails 0.5.5?
    ==========================

    Rails now works out of the box on Windows (no more symlinks), has an
    awesome WEBrick-based internal web server (Apache is still supported,
    of course), includes a ton of fixes for stuff that stumped people with
    0.5.0, and includes Action Pack 0.7.6 and Active Record 0.9.1. This is
    quite an important update. Unless you already got a lot going on 0.5.0,
    it’s recommended to switch directly to 0.5.5.

    Download from http://www.rubyonrails.org, talk on #rubyonrails
    (FreeNet).


    Changes for Rails
    =================

    * Works on Windows out of the box! (Dropped symlinks)

    * Added webrick dispatcher: Try "ruby public/dispatch.servlet --help"
    [Florian Gross]

    * Report errors about initialization to browser (instead of attempting
    to use uninitialized logger)

    * Upgraded to Action Pack 0.7.6

    * Upgraded to Active Record 0.9.1

    * Added distinct 500.html instead of reusing 404.html

    * Changed license to MIT License (and included license file in package)


    Changes for Action Pack
    =======================

    * Included ERB::Util so all templates can easily escape HTML content
    with <%=h @person.content %>

    * All requests are now considered local by default, so everyone
    will be exposed to detailed debugging screens on errors.
    When the application is ready to go public, set
    ActionController::Base.consider_all_requests_local to false,
    and implement the protected method local_request? in the controller
    to determine when debugging screens should be shown.

    * Fixed three bugs with the url_for/redirect_to/link_to handling.
    Considering the url http://localhost:81/friends/show/1

    url_for:)action => "list")
    ...used to give http://localhost:81/friends/list/1
    ......now gives http://localhost:81/friends/list

    url_for:)controller => "friends", :action => "destroy", :id => 5)
    ...used to give http://localhost:81/friends/destroy
    ......now gives http://localhost:81/friends/destroy/5

    Considering the url http://localhost:81/teachers/show/t

    url_for:)action => "list", :id => 5)
    ...used to give http://localhost:81/5eachers/list/t
    ......now gives http://localhost:81/teachers/list/5

    [Reported by David Morton & Radsaq]

    * Logs exception to logfile in addition to showing them for local
    requests

    * Protects the eruby load behind a begin/rescue block. eRuby is not
    required to run ActionController.

    * Fixed install.rb to also install clean_logger and the templates

    * Added ActiveRecordStore as a session option. Read more in
    lib/action_controller/session/active_record_store.rb [Tim Bates]

    * Changed license to MIT License (and included license file in package)

    * Application error page now returns status code 500 instead of 200

    * Fixed using Procs as layout handlers [Florian Weber]

    * Fixed bug with using redirects ports other than 80

    * Added index method that calls list on scaffolding


    Changes for Active Record
    =========================

    * Changed license to MIT License (and included license file in package)

    * Added natural object-style assignment for has_and_belongs_to_many
    associations.
    Consider the following model:

    class Event < ActiveRecord::Base
    has_one_and_belongs_to_many :sponsors
    end

    class Sponsor < ActiveRecord::Base
    has_one_and_belongs_to_many :sponsors
    end

    Earlier, you'd have to use synthetic methods for creating
    associations between two objects of the above class:

    roskilde_festival.add_to_sponsors(carlsberg)
    roskilde_festival.remove_from_sponsors(carlsberg)

    nike.add_to_events(world_cup)
    nike.remove_from_events(world_cup)

    Now you can use regular array-styled methods:

    roskilde_festival.sponsors << carlsberg
    roskilde_festival.sponsors.delete(carlsberg)

    nike.events << world_cup
    nike.events.delete(world_cup)

    * Added delete method for has_many associations. Using this will
    nullify an association between the has_many and the belonging
    object by setting the foreign key to null. Consider this model:

    class Post < ActiveRecord::Base
    has_many :comments
    end

    class Comment < ActiveRecord::Base
    belongs_to :post
    end

    You could do something like:

    funny_comment.has_post? # => true
    announcement.comments.delete(funny_comment)
    funny_comment.has_post? # => false



    What is Rails?
    ==============

    Rails is a open source web-application framework for Ruby. It ships
    with an answer for every letter in MVC: Action Pack for the Controller
    and View, Active Record for the Model.

    Everything needed to build real-world applications in less lines of
    code than other frameworks spend setting up their XML configuraion
    files. Like Basecamp, which was launched after 4 KLOCs and two months
    of developement by a single programmer.

    Being a full-stack framework means that all layers are built to work
    seemlessly together. That way you Don’t Repeat Yourself (DRY) and you
    can use a single language from top to bottom. Everything from templates
    to control flow to business logic is written in Ruby—the language of
    love for industry heavy-weights

    In striving for DRY compliance, Rails shuns configuration files and
    annotations in favor of reflection and run-time extensions. This means
    the end of XML files telling a story that has already been told in
    code. It means no compilation phase: Make a change, see it work.
    Meta-data is an implementation detail left for the framework to handle.


    What is Active Record?
    ======================

    Active Record connects business objects and database tables to create a
    persistable domain model where logic and data is presented in one
    wrapping. It’s an implementation of the object-relational mapping (ORM)
    pattern by the same name as described by Martin Fowler:

    An object that wraps a row in a database table or view,
    encapsulates the database access, and adds domain logic on that
    data.

    Active Record’s main contribution to the pattern is to relieve the
    original of two stunting problems: lack of associations and
    inheritance. By adding a simple domain language-like set of macros to
    describe the former and integrating the Single Table Inheritance
    pattern for the latter, Active Record narrows the gap of functionality
    between the data-mapper and active record approach.

    Learn more: http://activerecord.rubyonrails.org


    What is Action Pack?
    ====================

    Action Pack splits the response to a web request into a controller part
    (performing the logic) and a view part (rendering a template). This
    two-step approach is known as an action, which will normally create,
    read, update, or delete (CRUD for short) some sort of model part (often
    database) before choosing either to render a template or redirecting to
    another action.

    Action Pack implements these actions as public methods on Action
    Controllers and uses Action Views to implement the template rendering.
    Action Controllers are then responsible for handling all the actions
    relating to a certain part of an application. This grouping usually
    consists of actions for lists and for CRUDs revolving around a single
    (or a few) model objects. So ContactController would be responsible for
    listing contacts, creating, deleting, and update contacts. A
    WeblogController could be responsible for both posts and comments.

    Action View templates are written using embedded Ruby in tags mingled
    in with the HTML. To avoid cluttering the templates with code, a bunch
    of helper classes provide common behavior for forms, dates, and
    strings. And it’s easy to add specific helpers to keep the separation
    as the application extends.

    Learn more: http://actionpack.rubyonrails.org

    --
    David Heinemeier Hansson,
    http://www.rubyonrails.org/ -- Web-application framework for Ruby
    http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
    http://www.basecamphq.com/ -- Web-based Project Management
    http://www.loudthinking.com/ -- Broadcasting Brain
    http://www.nextangle.com/ -- Development & Consulting Services
     
    David Heinemeier Hansson, Jul 29, 2004
    #1
    1. Advertising

  2. I'm drooling. So does this mean I could write a rails app without
    messing with Apache at all and then just switch it over to Apache when
    I deploy without having to change more than a couple lines in a config
    file?

    On Thu, 29 Jul 2004 09:27:23 +0900, David Heinemeier Hansson
    <> wrote:
    > Rails now works out of the box on Windows (no more symlinks), has an
    > awesome WEBrick-based internal web server (Apache is still supported,
     
    Carl Youngblood, Jul 29, 2004
    #2
    1. Advertising

  3. Carl Youngblood wrote:

    >> Rails now works out of the box on Windows (no more symlinks), has an
    >> awesome WEBrick-based internal web server (Apache is still supported,

    > I'm drooling. So does this mean I could write a rails app without
    > messing with Apache at all and then just switch it over to Apache when
    > I deploy without having to change more than a couple lines in a config
    > file?


    Yes, all you have to do is adding a virtual host in your apache
    configuration. :)

    Regards,
    Florian Gross
     
    Florian Gross, Jul 29, 2004
    #3
  4. David Heinemeier Hansson wrote:

    > What's new in Rails 0.5.5?
    > ==========================
    >
    > Rails now works out of the box on Windows (no more symlinks), has an
    > awesome WEBrick-based internal web server (Apache is still supported,
    > of course), includes a ton of fixes for stuff that stumped people with
    > 0.5.0, and includes Action Pack 0.7.6 and Active Record 0.9.1. This is
    > quite an important update. Unless you already got a lot going on
    > 0.5.0, it’s recommended to switch directly to 0.5.5.
    >
    > Download from http://www.rubyonrails.org, talk on #rubyonrails (FreeNet).
    >
    >
    > Changes for Rails
    > =================
    >
    > * Works on Windows out of the box! (Dropped symlinks)


    Damn, that was fast :)

    --
    With best regards,
    Leonid Khachaturov
    mailto:
    web: http://web.yaroslavl.ru/blogs/leonya
     
    Leonid Khachaturov, Jul 29, 2004
    #4
  5. David Heinemeier Hansson

    Sascha Ebach Guest

    David, when you said on IRC that this is going to take some time I
    thought it would be a couple of weeks ... Only 3 days later, that is
    awesome. Thanks to you and all the contributors.

    > * Works on Windows out of the box! (Dropped symlinks)


    Way to go!

    > * Added webrick dispatcher: Try "ruby public/dispatch.servlet --help"
    > [Florian Gross]


    If you use this means you have to restart the webserver everytime you
    save a file, right?

    > * Changed license to MIT License (and included license file in
    > package)


    What are the consequences/benefits of that?


    And, will there be new videos? ;)

    Thanx
    --
    Sascha Ebach
     
    Sascha Ebach, Jul 29, 2004
    #5
  6. >> * Added webrick dispatcher: Try "ruby public/dispatch.servlet --help"
    >> [Florian Gross]

    >
    > If you use this means you have to restart the webserver everytime you
    > save a file, right?


    That's were the work of Florian _really_ impressed me. See the
    command-line options:

    $ ruby dispatch.servlet --help
    Usage: ruby dispatch.servlet [options]

    -p, --port=port Runs Rails on the specified port. Default: 3000
    -i, --index=controller Specifies an index controller that requests
    for root will go to
    (instead of congratulations screen).
    -d, --daemon Make Rails run as a Daemon (only works if fork
    is available -- meaning on *nix).
    -a, --auto-reload Auto-reloads all the classes on each request
    (use during development).

    If you start the server with --auto-reload, each request will get its
    interpreter -- just like running as CGI! The server accomplishes this
    by instead of using its own interpreter, it'll boot a new one during
    request handling. Here's the juicy bit:

    IO.popen("ruby", "r+") do |ruby|
    ruby.puts <<-END
    require 'cgi'
    require 'stringio'
    env = #{env.inspect}
    CGI.send:)define_method, :env_table) { env }
    $stdin = StringIO.new(#{(req.body || "").inspect})

    Dir.chdir(#{@server_options[:server_root].inspect})

    eval(
    'load "dispatch.rb"',
    binding,
    #{File.join(@server_options[:server_root], "dispatch.rb").inspect}
    )
    END
    ruby.close_write
    data = ruby.read
    end

    >> * Changed license to MIT License (and included license file in
    >> package)

    >
    > What are the consequences/benefits of that?


    The Ruby license had a bunch of stuff specific to Ruby. MIT license is
    much simpler and very free. Have a look at
    http://www.rubyonrails.org/show/License for more.

    > And, will there be new videos? ;)


    You betcha! I just got my fancy Sony microphone hooked up, so the next
    videos will also have a voice over. I'll be posting them to the newly
    established Rails Academy at
    http://www.rubyonrails.org/show/RailsAcademy
    --
    David Heinemeier Hansson,
    http://www.rubyonrails.org/ -- Web-application framework for Ruby
    http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
    http://www.basecamphq.com/ -- Web-based Project Management
    http://www.loudthinking.com/ -- Broadcasting Brain
    http://www.nextangle.com/ -- Development & Consulting Services
     
    David Heinemeier Hansson, Jul 29, 2004
    #6
  7. David Heinemeier Hansson

    Sascha Ebach Guest

    > If you start the server with --auto-reload, each request will get its
    > interpreter -- just like running as CGI! The server accomplishes this by
    > instead of using its own interpreter, it'll boot a new one during
    > request handling. Here's the juicy bit:
    >
    > IO.popen("ruby", "r+") do |ruby|
    > ruby.puts <<-END
    > require 'cgi'
    > require 'stringio'
    > env = #{env.inspect}
    > CGI.send:)define_method, :env_table) { env }
    > $stdin = StringIO.new(#{(req.body || "").inspect})
    >
    > Dir.chdir(#{@server_options[:server_root].inspect})
    >
    > eval(
    > 'load "dispatch.rb"',
    > binding,
    > #{File.join(@server_options[:server_root], "dispatch.rb").inspect}
    > )
    > END
    > ruby.close_write
    > data = ruby.read
    > end


    Ah, that is fantastic! That means you can even use CONSTANTS which is
    not possible with frameworks like Cerise or mod_ruby (which also has an
    autoreload, these days)

    >>> * Changed license to MIT License (and included license file in
    >>> package)

    >>
    >>
    >> What are the consequences/benefits of that?

    >
    >
    > The Ruby license had a bunch of stuff specific to Ruby. MIT license is
    > much simpler and very free. Have a look at
    > http://www.rubyonrails.org/show/License for more.


    cool

    >> And, will there be new videos? ;)

    >
    >
    > You betcha! I just got my fancy Sony microphone hooked up, so the next
    > videos will also have a voice over. I'll be posting them to the newly
    > established Rails Academy at http://www.rubyonrails.org/show/RailsAcademy


    Oh man, you amaze us! Really looking forward to video tutorials with
    audio commentary. How great is that!

    --
    Sascha Ebach
     
    Sascha Ebach, Jul 29, 2004
    #7
  8. David Heinemeier Hansson

    Dave Wilson Guest

    Sascha Ebach <> wrote:
    > ... or mod_ruby (which also has an autoreload, these days)


    really? where can I find more info on this?

    thanks,
    Dave
     
    Dave Wilson, Jul 29, 2004
    #8
  9. David Heinemeier Hansson

    Sascha Ebach Guest

    Sascha Ebach, Jul 29, 2004
    #9
  10. Re: [OT] microphone (was [ANN] Rails 0.5.5: Windows, WEBrick, lots!)

    On Thu, 29 Jul 2004 18:25:28 +0900, David Heinemeier Hansson
    <> wrote:
    > You betcha! I just got my fancy Sony microphone hooked up, so the next
    > videos will also have a voice over. I'll be posting them to the newly
    > established Rails Academy at
    > http://www.rubyonrails.org/show/RailsAcademy


    What microphone did you get? I've been considering getting one for a
    while and didn't know which one to get. I have a 12" iBook which I
    don't think has a conventional input port.
     
    Carl Youngblood, Jul 29, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brad
    Replies:
    9
    Views:
    375
    Bruno Desthuilliers
    Jun 19, 2008
  2. David Heinemeier Hansson
    Replies:
    3
    Views:
    159
    James Britt
    Nov 18, 2004
  3. Lloyd Zusman
    Replies:
    2
    Views:
    411
  4. Aaron Smith

    WEBrick::Daemon and WEBrick

    Aaron Smith, Mar 9, 2007, in forum: Ruby
    Replies:
    2
    Views:
    319
    Aaron Smith
    Mar 18, 2007
  5. coolneo
    Replies:
    9
    Views:
    197
    coolneo
    Jan 30, 2007
Loading...

Share This Page