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

  • Thread starter David Heinemeier Hansson
  • Start date
D

David Heinemeier Hansson

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
 
C

Carl Youngblood

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?
 
F

Florian Gross

Carl said:
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
 
L

Leonid Khachaturov

David said:
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 :)
 
S

Sascha Ebach

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
 
D

David Heinemeier Hansson

* 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
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
 
S

Sascha Ebach

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)
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



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!
 
C

Carl Youngblood

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,836
Messages
2,569,750
Members
45,545
Latest member
rapter____0

Latest Threads

Top