Hello,
I want report a suggestion.
Now rails is great because in one framework we have all!
Most of us don't like prototype, rjs & c.
In my opinion we can make the easy use of rails with ajax in a
unobtrusive way.
See that:
Helpers: The most usefull helper are
link_to_remote, form_remote etc... but in my opinion make the html
code very unclean:
Why do some like this?
<a href="#" onclick="new Ajax.Updater({success:'posts',failure:'error'}, '/blog/destroy/5',
{asynchronous:true, evalScripts:true}); return false;">Delete this post</a>
in favor of:
<a href="'/blog/destroy/5" onclick="linkToRemote('/blog/destroy/5');">Delete this post</a>
Then you can easy make a /adapter.js (yes the template can be in
prototype) with all ajax functions that are used by
prototype/scriptaculus helpers like:
function linkToRemote(url){
new Ajax.Updater({success:'posts',failure:'error'}, url, ...
}
So we can rename this two modules in
AjaxHelper/EffectsHelper...
In this way, rails can be bundled with prototype and for a lot
of newbie users still happy without any problem with this change.
But for the most users that love jquery, mootools, extjs can simply
change their adapter.js and use all beautifull ajax/effects helpers
without install some (good) plugins like jRails and edit by hand
all helpers.
Views: Now if we make an ajax request mime:
text/javascripts rails look for rjs template.
Ive see very very few project that use it and I don't know any
person that love and use rjs templates, because are limited and are
not a standard... Why don't remove rjs in favor of a simply js.erb
template?
In controllers we can still use some like:
render :js do |page|
page.replace_html ...
end
and in our adapter.js
function replaceHtml(id, text){
new Element.update(id, text);
}
(Im not sure that the prototype syntax are correct :D)
also why this?:
render :update do |page|
page << "alert('test')"
end
and not:
render :js => "alert('test')"
I know there is format.js, but all this small changes for people
that don't use prototype complicate the life
I think you can follow my suggestion, rails still easy for
prototype users, but very very flexible for people that need some
different js frameworks. And in my opinion can be a standard.
Think in future when people can do this:
rails myapp --js prototype/jquery/mootools
One more thing, like merb, why insert haml as choice of
developper integrated in rails?
rails myapp --template erb/haml
Thanks