mandazi

web development, gaming, sports, life, etc.

Archive for the ‘Code’ Category

How to add a class to the form_for tag in Ruby on Rails

without comments

I’ve searched for a while and couldn’t figure this out until I actually picked up my book and browsed the source of examples. I’ll get straight to the code:


<% form_for :user, :url => users_path,:html => { :class => ’standard-form’ } do |f| -%>

That produces:

As you can see I added a class called “standard-form” to the form tag.

Written by Amir Sahib

October 12th, 2009 at 10:40 pm

How to embed high-quality YouTube videos to your site

with one comment

It’s very simple. Just add the code below to the end of the value and embed src part of the embed code.

&ap=%2526fmt%3D18

Where exactly are the ‘value’ and ‘embed src’ tags? Look for these items in the code:

…………..value=”http://www.youtube.com/v/wmaTyD7NnCI&hl=en&fs=1&ap=%2526fmt%3D18“……….embed src=”http://www.youtube.com/v/wmaTyD7NnCI&hl=en&fs=1&ap=%2526fmt%3D18” ………

Try it out!

Written by Amir Sahib

November 6th, 2008 at 10:38 pm