Ruby on Rails
Tuesday, November 18, 2014
This particular point is not well documented.
The best thing to do is to read the source and experiment: https://github.com/rails/rails/blob/52fddcc653458456f98b3683dffd781cf00b35fe/actionview/lib/action_view/helpers/tag_helper.rb
I conclude that:
- boolean attributes must receive true or false and work as expected
- the only keys that treat hashes magically are are `data` and `aria`, others just return `inspect` on the Hash which is not what we want
- Array values are space joined
- anything else just generates a a="b" attribute after string conversions
Then as you noticed, helpers may add more keys which are treated specially. Those are well documented on a per-helper basis.
On Wednesday, October 6, 2010 4:54:42 PM UTC+2, Ruby-Forum.com User wrote:
-- The best thing to do is to read the source and experiment: https://github.com/rails/rails/blob/52fddcc653458456f98b3683dffd781cf00b35fe/actionview/lib/action_view/helpers/tag_helper.rb
I conclude that:
- boolean attributes must receive true or false and work as expected
- the only keys that treat hashes magically are are `data` and `aria`, others just return `inspect` on the Hash which is not what we want
- Array values are space joined
- anything else just generates a a="b" attribute after string conversions
Then as you noticed, helpers may add more keys which are treated specially. Those are well documented on a per-helper basis.
On Wednesday, October 6, 2010 4:54:42 PM UTC+2, Ruby-Forum.com User wrote:
I've noticed lots of people online complain about not good documentation
for Rails. I'm a PHP programmer but I'm a newbie on Rails.I'm creating a form with a drop-down menu. I finally got to do it. I
noticed there is a html_options parameter for select. I was curious as
to what other html_options are available but couldn't find a list of
options. I have been looking for it at the api
http://api.rubyonrails.org but can't seem to find it. Maybe I'm not
looking in the right places.Can somebody please point me to a place in a documentation where I can
find a complete list for the different options for html_options
parameter?
--
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0e73f911-6844-4690-9d76-546c168b4f5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment