USA State list for Rails

Every time we need this migration script for our projects Use following command for Model generate [siwan@localhost siwan]$ ruby script/generate model UsStates exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/us_states.rb create test/unit/us_states_test.rb create test/fixtures/us_states.yml exists db/migrate create db/migrate/20091117115011_create_us_states.rb [siwan@localhost siwan]$ … Continue reading

Install Apatana Studio on Fedora 9

Installation of Apatana in Detail 1. Download zip file from this location( File 2. Then uncompress the .zip file. and copy the resulting ‘aptana’ folder under ‘/home/siwan’.(siwan is my username for fedora, you have replace your username) 3. Install … Continue reading

deconstructing date_select in rails

// Reconstruct a date object from date_select helper form params // place this code into your application.rb file def build_date_from_params(field_name, params)["#{field_name.to_s}(1i)"].to_i, params["#{field_name.to_s}(2i)"].to_i, params["#{field_name.to_s}(3i)"].to_i) end //You can changes order of displaying into view <%= date_select ‘from’, ‘date’ ,:order => [:day, … Continue reading