*SVN*
* Added arrays as a value option for params in url_for and friends #467 [Eric Anderson]. Example:
url_for(:controller => 'user', :action => 'delete', :params => { 'username' => %( paul john steve ) } )
# => /user/delete?username[]=paul&username[]=john&username[]=steve
* Fixed that controller tests can now assert on the use of cookies #466 [Alexey]
* Fixed that send_file would "remember" all the files sent by adding to the headers again and again #458 [bitsweat]
* Fixed url rewriter confusion when the controller or action name was a substring of the controller_prefix or action_prefix
* Added conditional layouts like layout "weblog_standard", :except => :rss #452 [Marcel Molina]
* Fixed that MemCacheStore wasn't included by default and added default MemCache object pointing to localhost #447 [Lucas Carlson]
* Added fourth argument to render_collection_of_partials that allows you to specify local_assigns -- just like render_partial #432 [zenspider]
* Fixed that host would choke when cgi.host returned nil #432 [Tobias Luetke]
* Added that form helpers now take an index option #448 [Tim Bates]
Example:
text_field "person", "name", "index" => 3
Becomes:
* Fixed three issues with retrying breakpoints #417 [Florian Gross]
1. Don't screw up pages that use multiple values for the same parameter (?foo=bar&foo=qux was converted to ?foo=barqux)
2. Don't screw up all forms when you click the "Retry with Breakpoint" link multiple times instead of reloading
(This caused the parameters to be added multiple times for GET forms leading to trouble.)
3. Don't add ?BP-RETRY=1 multiple times
* Added that all renders and redirects now return false, so they can be used as the last line in before_filters to stop execution.
Before:
def authenticate
unless @session[:authenticated]
redirect_to :controller => "account", :action => "login"
return false
end
end
After:
def authenticate
redirect_to(:controller => "account", :action => "login") unless @session[:authenticated]
end
* Added conditional filters #431 [Marcel]. Example:
class JournalController < ActionController::Base
# only require authentication if the current action is edit or delete
before_filter :authorize, :only_on => [ :edit, :delete ]
private
def authorize
# redirect to login unless authenticated
end
end
* Added Base#render_nothing as a cleaner way of doing render_text "" when you're not interested in returning anything but an empty response.
* Added the possibility of passing nil to UrlHelper#link_to to use the link itself as the name
*1.2.0* (January 4th, 2005)
* Added MemCacheStore for storing session data in Danga's MemCache system [Bob Cottrell]
Depends on: MemCached server (http://www.danga.com/memcached/), MemCache client (http://raa.ruby-lang.org/project/memcache/)
* Added thread-safety to the DRbStore #66, #389 [Ben Stiglitz]
* Added DateHelper#select_time and DateHelper#select_second #373 [Scott Baron]
* Added :host and :protocol options to url_for and friends to redirect to another host and protocol than the current.
* Added class declaration for the MissingFile exception #388 [Kent Sibilev]
* Added "short hypertext note with a hyperlink to the new URI(s)" to redirects to fulfill compliance with RFC 2616 (HTTP/1.1) section 10.3.3 #397 [Tim Bates]
* Added second boolean parameter to Base.redirect_to_url and Response#redirect to control whether the redirect is permanent or not (301 vs 302) #375 [Hodel]
* Fixed redirects when the controller and action is named the same. Still haven't fixed same controller, module, and action, though #201 [Josh]
* Fixed problems with running multiple functional tests in Rails under 1.8.2 by including hack for test/unit weirdness
* Fixed that @request.remote_ip didn't work in the test environment #369 [Bruno Mattarollo]
*1.1.0*
* Added search through session to clear out association caches at the end of each request. This makes it possible to place Active Record objects
in the session without worrying about stale data in the associations (the main object is still subject to caching, naturally) #347 [Tobias Luetke]
* Added more informative exception when using helper :some_helper and the helper requires another file that fails, you'll get an
error message tells you what file actually failed to load, rather than falling back on assuming it was the helper file itself #346 [dblack]
* Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
validation where the value would normally be "100".
* Added Request#port_string to get something like ":8080" back on 8080 and "" on 80 (or 443 with https).
* Added Request#domain (returns string) and Request#subdomains (returns array).
* Added POST support for the breakpoint retries, so form processing that raises an exception can be retried with the original request [Florian Gross]
* Fixed regression with Base#reset_session that wouldn't use the the DEFAULT_SESSION_OPTIONS [adam@the-kramers.net]
* Fixed error rendering of rxml documents to not just swallow the exception and return 0 (still not guessing the right line, but hey)
* Fixed that textilize and markdown would instantiate their engines even on empty strings. This also fixes #333 [Ulysses]
* Fixed UrlHelper#link_to_unless so it doesn't care if the id is a string or fixnum [zenspider]
*1.0.1*
* Fixed a bug that would cause an ApplicationController to require itself three times and hence cause filters to be run three times [evl]
*1.0*
* Added that controllers will now attempt to require a model dependency with their name and in a singular attempt for their name.
So both PostController and PostsController will automatically have the post.rb model required. If no model is found, no error is raised,
as it is then expected that no match is available and the programmer will have included his own models.
* Fixed DateHelper#date_select so that you can pass include_blank as an option even if you don't use start_year and end_year #59 [what-a-day]
* Added that controllers will now search for a layout in $template_root/layouts/$controller_name.r(html|xml), so PostsController will look
for layouts/posts.rhtml or layouts/posts.rxml and automatically configure this layout if found #307 [Marcel]
* Added FormHelper#radio_button to work with radio buttons like its already possible with check boxes [Michael Koziarski]
* Added TemplateError#backtrace that makes it much easier to debug template errors from unit and functional tests
* Added display of error messages with scaffolded form pages
* Added option to ERB templates to swallow newlines by using <% if something -%> instead of just <% if something %>. Example:
class SomeController < ApplicationController
<% if options[:scaffold] %>
scaffold :<%= singular_name %>
<% end %>
helper :post
...produces this on post as singular_name:
class SomeController < ApplicationController
scaffold :post
helper :post
...where as:
class SomeController < ApplicationController
<% if options[:scaffold] -%>
scaffold :<%= singular_name %>
<% end -%>
helper :post
...produces:
class SomeController < ApplicationController
scaffold :post
helper :post
[This undocumented gem for ERb was uncovered by bitsweat]
* Fixed CgiRequest so that it'll now accept session options with Symbols as keys (as the documentation points out) [Suggested by Andreas]
* Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
local_assigns hash that overrides it. As a result, render_collection_of_partials can still be written in terms of render_partial
and partials that make use of a counter can be called without problems from both render_collection_of_partials as well as
render_partial #295 [marcel]
* Fixed CgiRequest#out to fall back to #write if $stdout doesn't have #syswrite [bitsweat]
* Fixed all helpers so that they use XHTML compliant double quotes for values instead of single quotes [htonl/bitsweat]
* Added link_to_image(src, options = {}, html_options = {}, *parameters_for_method_reference). Documentation:
Creates a link tag to the image residing at the +src+ using an URL created by the set of +options+. See the valid options in
link:classes/ActionController/Base.html#M000021. It's also possible to pass a string instead of an options hash to
get a link tag that just points without consideration. The html_options works jointly for the image and ahref tag by
letting the following special values enter the options on the image and the rest goes to the ahref:
::alt: If no alt text is given, the file name part of the +src+ is used (capitalized and without the extension)
::size: Supplied as "XxY", so "30x45" becomes width="30" and height="45"
::align: Sets the alignment, no special features
The +src+ can be supplied as a...
* full path, like "/my_images/image.gif"
* file name, like "rss.gif", that gets expanded to "/images/rss.gif"
* file name without extension, like "logo", that gets expanded to "/images/logo.png"
* Fixed to_input_field_tag so it no longer explicitly uses InstanceTag.value if value was specified in the options hash [evl]
* Added the possibility of having validate be protected for assert_(in)valid_column #263 [Tobias Luetke]
* Added that ActiveRecordHelper#form now calls url_for on the :action option.
* Added all the HTTP methods as alternatives to the generic "process" for functional testing #276 [Tobias Luetke]. Examples:
# Calls Controller#miletone with a GET request
process :milestone
# Calls Controller#miletone with a POST request that has parameters
post :milestone, { "name" => "David" }
# Calls Controller#milestone with a HEAD request that has both parameters and session data
head :milestone, { "id" => 1 }, { "user_id" => 23 }
This is especially useful for testing idiomatic REST web services.
* Added proper handling of HEAD requests, so that content isn't returned (Request#head? added as well) #277 [Eric Hodel]
* Added indifference to whether @headers["Content-Type"], @headers["Content-type"], or @headers["content-type"] is used.
* Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
cookie-based sessions #275 [jcf]
* Fixed that cached template loading would still check the file system to see if the file existed #258 [Andreas Schwarz]
* Added options to tailor header tag, div id, and div class on ActiveRecordHelper#error_messages_for [josh]
* Added graceful handling of non-alphanumeric names and misplaced brackets in input parameters [bitsweat]
* Added a new container for cookies that makes them more intuative to use. The old methods of cookie and @cookies have been deprecated.
Examples for writing:
cookies["user_name"] = "david" # => Will set a simple session cookie
cookies["login"] = { "value" => "XJ-122", "expires" => Time.now + 360} # => Will set a cookie that expires in 1 hour
Examples for reading:
cookies["user_name"] # => "david"
cookies.size # => 2
Read more in ActionController::Cookies
NOTE: If you were using the old accessor (cookies instead of @cookies), this could potentially break your code -- if you expect a full cookie object!
* Added the opportunity to defined method_missing on a controller which will handle all requests for actions not otherwise defined #223 [timb]
* Fixed AbstractRequest#remote_ip for users going through proxies - Patch #228 [Eric Hodel]
* Added Request#ssl? which is shorthand for @request.protocol == "https://"
* Added the choice to call form_tag with no arguments (resulting in a form posting to current action) [bitsweat]
* Upgraded to Builder 1.2.1
* Added :module as an alias for :controller_prefix to url_for and friends, so you can do redirect_to(:module => "shop", :controller => "purchases")
and go to /shop/purchases/
* Added support for controllers in modules through @params["module"].
* Added reloading for dependencies under cached environments like FastCGI and mod_ruby. This makes it possible to use those environments for development.
This is turned on by default, but can be turned off with ActionController::Base.reload_dependencies = false in production environments.
NOTE: This will only have an effect if you use the new model, service, and observer class methods to mark dependencies. All libraries loaded through
require will be "forever" cached. You can, however, use ActionController::Base.load_or_require("library") to get this behavior outside of the new
dependency style.
* Added that controllers will automatically require their own helper if possible. So instead of doing:
class MsgController < ApplicationController
helper :msg
end
...you can just do:
class MsgController < ApplicationController
end
* Added dependencies_on(layer) to query the dependencies of a controller. Examples:
MsgController.dependencies_on(:model) # => [ :post, :comment, :attachment ]
MsgController.dependencies_on(:service) # => [ :notification_service ]
MsgController.dependencies_on(:observer) # => [ :comment_observer ]
* Added a new dependency model with the class methods model, service, and observer. Example:
class MsgController < ApplicationController
model :post, :comment, :attachment
service :notification_service
observer :comment_observer
end
These new "keywords" remove the need for explicitly calling 'require' in most cases. The observer method even instantiates the
observer as well as requiring it.
* Fixed that link_to would escape & in the url again after url_for already had done so
*0.9.5* (28)
* Added helper_method to designate that a given private or protected method you should available as a helper in the view. [bitsweat]
* Fixed assert_rendered_file so it actually verifies if that was the rendered file [htonl]
* Added the option for sharing partial spacer templates just like partials themselves [radsaq]
* Fixed that Russia was named twice in country_select [alexey]
* Fixed request_origin to use remote_ip instead of remote_addr [bitsweat]
* Fixed link_to breakage when nil was passed for html_options [alexey]
* Fixed redirect_to on a virtual server setup with apache with a port other than the default where it would forget the port number [seanohalpin]
* Fixed that auto-loading webrick on Windows would cause file uploads to fail [bitsweat]
* Fixed issues with sending files on WEBrick by setting the proper binmode [bitsweat]
* Added send_data as an alternative to send_file when the stream is not read off the filesystem but from a database or generated live [bitsweat]
* Added a new way to include helpers that doesn't require the include hack and can go without the explicit require. [bitsweat]
Before:
module WeblogHelper
def self.append_features(controller) #:nodoc:
controller.ancestors.include?(ActionController::Base) ? controller.add_template_helper(self) : super
end
end
require 'weblog_helper'
class WeblogController < ActionController::Base
include WeblogHelper
end
After:
module WeblogHelper
end
class WeblogController < ActionController::Base
helper :weblog
end
* Added a default content-type of "text/xml" to .rxml renders [Ryan Platte]
* Fixed that when /controller/index was requested by the browser, url_for would generates wrong URLs [Ryan Platte]
* Fixed a bug that would share cookies between users when using FastCGI and mod_ruby [The Robot Co-op]
* Added an optional third hash parameter to the process method in functional tests that takes the session data to be used [alexey]
* Added UrlHelper#mail_to to make it easier to create mailto: style ahrefs
* Added better error messages for layouts declared with the .rhtml extension (which they shouldn't) [geech]
* Added another case to DateHelper#distance_in_minutes to return "less than a minute" instead of "0 minutes" and "1 minute" instead of "1 minutes"
* Added a hidden field to checkboxes generated with FormHelper#check_box that will make sure that the unchecked value (usually 0)
is sent even if the checkbox is not checked. This relieves the controller from doing custom checking if the the checkbox wasn't
checked. BEWARE: This might conflict with your run-on-the-mill work-around code. [Tobias Luetke]
* Fixed error_message_on to just use the first if more than one error had been added [marcel]
* Fixed that URL rewriting with /controller/ was working but /controller was not and that you couldn't use :id on index [geech]
* Fixed a bug with link_to where the :confirm option wouldn't be picked up if the link was a straight url instead of an option hash
* Changed scaffolding of forms to use