Following on from my last post, sorry folks a bit more Rails bashing. What happened to convention over configuration and the principle of least surprise?
So to add a plain old class attribute to a form tag using the form_for helper you need to do (notice this time we’re declaring the actual html options with the [...]
Some days I love Rails, some days it really frustrates me.
Anyways spent 10 minutes remembering the syntax for the form_for helper to add a regular class attribute. The second hash of parameters are the HTML ones! Thought I’d blog it for my own records:
123<% form_tag( { :action => "destroy", :method => "delete" }, :class => [...]
This in Ruby/Rails:
1<%= request.path %>
Seems to be the equivalent of this in PHP:
1<?=$_SERVER[’PHP_SELF’]?>
Handy for submitting things to themselves with out any parameters being passed.
I always used to log-out / log-back-in to shell, to allow changes in my .bash_profile to kick in. I’m guessing this would work in OSX with your .profile file too but I’ve not tested it. Anyways, I discovered you can reload the script on the fly using:
1source ~/.bash_profile