…and use your custom link renderer at this point you're likely to get an uninitialized constant ActionView:: CompiledTemplates:: PaginationListLinkRenderer exception. This is because, unlike Rails 2.x, the current release candidate of Rails 3 doesn't autoload code in the lib directory. There's a lengthy and at times heated discussion of this over on the Rails bug tracker which has not yet been formally resolved. In the meantime you can restore the old Rails 2.x …
…adding patches to your Rails application. For example if you later need to patch a bug in ActionView then you could simply make a lib/patches/action_view.rb file containing the code for the patch and it will automatically be loaded when you next start your app.
The patch file overwrites the broken parse_query and normalize_params methods using the fixed code from Rack 1.2.
You can easily verify that the patch is working by firing up a Rails console (using script/console ) and trying …
ActionView:: TemplateError (undefined method `interpolate_without_deprecated_syntax' for # ) on line #5 of themes/scribbish/views/articles/_comment.html.erb:
{typo:code}
So I assumed this was some compatibility between Typo and Rails and Typo had a workaround defined in the environment.rb file file. As I use Rails 2.3.8 I disabled that workaround and everything seems to work again:
So I just removed the followed lines from the enviroment.rb file: environment.rb class I18n::Backend::Simple …
2. ActionView::Helpers:: PrototypeHelper
ActionView::Helpers:: PrototypeHelper has been heavily modified. The following helpers have been removed and made available as a plugin .
button_to_remote
submit_to_remote
observe_field
observe_form
periodically_call_remote
link_to_remote (*)
form_remote_tag (*)
form_remote_for (*)
remote_form_for (*)
(*) partially supported using the :remote => true option. See section 3.
If you are using one of these tags, you …
…params come from in a Rails 3 application? The answer is two places. First there is a new ActionView::Helpers:: CsrfHelper module that allows you to use the #csrf_meta_tag helper in the head of your layout files. This helper will generate two meta tags, one for the authentication parameter name and the other for the value. The second place is in the new rails.js which reads these two meta tags for further interpolation into some generated form tags for all sorts of :remote links, buttons, …
…testing. The improvements are numerous: ActiveRecord, ActionController, ActionView, and ActionMailer, ActiveSupport have all been redesigned. ActiveRecord got pimped with ActiveRelation scoped queries.
Some components have been refactored into their own: ActionDispatch, ActiveModel. Even better, all components can be used alone and you don't have to require the entire Rails framework.
Rails is now not only Rack compatible, but subcomponents of Rails, like routing, …
ActionView
ActionView got a significant overhaul, improving its internal architecture, increasing performance, adding pervasive XSS protection, and making all JavaScript helpers unobtrusive.
In terms of architecture, Rails 3 defines a clear boundary between ActionController and ActionView. Now, ActionView exposes a single API entry point for rendering templates and partials, making the code path easier to understand, eliminating a number of latent (but unusual) bugs, and making …
As one last example, the way that ActionController communicates with ActionView itself has become a fully defined, exposed API. From the perspective of ActionController, a view implements three APIs:
Context.for controller(controller)
Context#render_partial(options)
Context#render_template(template, layout, options)
By implementing this API, you can drop in any object in place of ActionView. How would you use this? Well to date, I can think of two examples: rspec_rails is going …
…e-mail subjects, page content, date and time localization, pluralization rules and even in many of ActionView helpers. So in such cases, it's worth to give such extensions a try.
Running benchmarks on your own
If you want to run benchmarks on your own, it's quite simple. You just need to do:
git clone git: // github.com / svenfuchs / i18n.git cd i18n ruby benchmark / run.rb
Credits
The possibility to have backends and such extensions is due to Sven Fuchs , which …
Recently I've been developing a new Ruby on Rails web application. I learned some new tricks, relearned old pitfalls, and found some mistakes that I'd like to share with you.
Our team decided to implement the webapp in a non-conventional approach, using Dojo Toolkit-based full AJAX frontend, without using any ActionView functionality. It turned that it went quite well, but there are some things that we weren't aware of and now we know how to deal with it, and you will too.