HTML5 support with rails 4.0.2

16 views
Skip to first unread message

Hemant Bhargava

unread,
Mar 17, 2015, 2:21:34 PM3/17/15
to rubyonra...@googlegroups.com
I just started learning Rails 4.0.2. I was wondering if there is
anything(any gem?) which allows the support of html5 in rails .html.erb
pages..

So basically, lets say, If I create an email field in my .html.erb, It
would look like as :

<%= f.text_field :email %>
And in html5, you can simply use

<input type="email" ..>
which make sure that email format is correct..

My question is:

Is it possible to use <%= f.email ... %> in .html.erb pages using the
help of anything?

I hope I made my question clear. I won't mind writing more about it if
it is not clear..

--
Posted via http://www.ruby-forum.com/.

Hemant Bhargava

unread,
Mar 17, 2015, 2:33:33 PM3/17/15
to rubyonra...@googlegroups.com
Found it on stackoverflow..



Rails does support HTML5, try this in your view

= f.email_field :email
Just make sure your layout starts with <!DOCTYPE html> tag (which is
added for you by default).

You should read more about this and other view-related helpers in the
excellent Guide on the topic, these HTML5 helpers are detailed in the
Other Helpers section
Reply all
Reply to author
Forward
0 new messages