Radio Button

<% form_for(@vote) do |f| %>
  <%= f.error_messages %>

  <% @survey_options.each do |survey_option| %>
    <table>
      <tr>
        <td>
             <%= f.radio_button 'survey_option_id', survey_option.id %>
             <%= f.label(:survey_option, survey_option.name) %>
       </td>
     </tr>
   </table>
  <% end %>

  <p>
    <%= f.submit 'Create' %>
  </p>
<% end %>

hidden_field

<%= f.hidden_field :survey_title_id, :value => @survey_title.id %>

Namespace Tutorial

ruby script/generate scaffold SurveyOption name:string disable:boolean survey_title:references

rake db:migrate

ruby script/generate controller Admin::Survey_Options

map.namespace :admin do |admin|
admin.resources :survey_options
end

copy all codes in controller/survey_options_controller.rb to controller/admin/survey_options_controller.rb

change redirect_to(@survey_option) to redirect_to([:admin, @survey_option]) and redirect_to(survey_option_url) to redirect_to(admin_survey_options_url)

copy all files in views/survey_options to views/admin/survey_options

edit views/admin/survey_options/edit, index, new, show files.


http://railsforum.com/viewtopic.php?id=21742
http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial

Better than Bort - BaseApp

To use BaseApp read the tutorial below
  • http://github.com/ariejan/baseapp/tree/master
  • http://vladzloteanu.wordpress.com/2009/07/13/rails-startup-app-basecamp-user-authentication/

MySQL Socket

To find the correct path to mysql socket
  • mysql_config --socket

Column Properties

String - shot character
Text - long string
Integer - no decimal
Boolean - true or false
Float - number with decimal
Date - calendar date

Using Bort

Download and extract Bort - http://github.com/fudgestudios/bort/tree/master

Configure
  • config/settings.yml
  • config/database.yml
  • db/migrate/bort_migration.rb

Command
  • rake db:create
  • rake db:migrate