Memoization to speed up your Rails Application by caching method results
As to be found on rails-bestpractices.com At least in Rails 2.2 (didn’t confirm any version by myself) you simply add a call to ‘memoize :method_name’ to your class, after extending the class with ‘ActiveSupport::Memoizable’.
One more reason to have a closer look at SproutCore?
I just read Yehuda Katzs blog article, talking about his past and future work on open source web technologies. Besides this Katz describes his vision of an open source Framework for the client-side part of rich web applications, not missing a glance at iphone, android, ipad and other mobile challenges for webdevelopers. After Charles Jolley announced in his blog, that he leaves apple to found a company focussing on the development of the Javascript Framework SproutCore Katz saw his vision on such framework mirrored, and well, now he joined Charles company Strobe Inc. and helps carrying on SproutCore.
If you’re interested in SproutCore maybe also checkout Wikipedia, and don’t miss to have a look at Demo Applications, such as this Task List Application build with SproutCore(User ‘guest’, no password)
Katz also mentions that he intents to use Rails, especially with the upcoming features of Rails 3.1, as a Backend for his projects, and that he will continue to work on Rails for Engine Yard.
Why the f... is form_for with a new non-active record model posting to 'create'-action?
While in Rails3 Active Model takes care of all the Active Record Goodies which you might also need in non-activerecord / non-database Models, you sometimes have to trick on older Rails Versions.
For example using form_for tries to call the ‘new_record?’ method on the model, and will not treat it as a new model unless it returns true.
In my case the non-activerecord model was only used to send Invitations to friends. There was no need to ever edit it again, so i could help myself by simply adding
def new_record? true end
to my Invitation Model.