Rails beginner
Rails beginner

Reputation: 14504

Rails / Ruby - HTML attribute problem -

I have a tooltip that use this html attribute "original-title".

I have tryed this:

content_tag(:span, '', :class => options[:pinfo_class], :original-title => options[:pinfo])

But it gives a error in view.

Then I have used this which works, but not with the tooltip.

content_tag(:span, '', :class => options[:pinfo_class], :original_title => options[:pinfo])

How do I force rails to use the :original-title ?

Upvotes: 0

Views: 183

Answers (1)

Toms Mikoss
Toms Mikoss

Reputation: 9437

You can use a string as a hash key, like 'original-title' => options[:pinfo]. Should work.

Also, most strings can be converted to symbols via 'some-string'.to_sym method, or even defined as :'some-string'.

Upvotes: 5

Related Questions