Skip to main content
Home
Live to Learn!

Main navigation

  • Home
  • Learn
    • FoxPro
    • MS-DOS
    • C PRG
    • Java
    • ASP
    • Ruby on Rails
    • ASP.NET
    • E-Books
    • Exam Preparation
    • Tools
  • Blog
  • Forums
  • Contact
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Ruby and Rails

Simple Form Hello Rails Application

Book navigation

  • Single line swapping in Ruby
  • Array Operations in Ruby
  • File operations in Ruby
  • User defined functions in Ruby
  • Classes and Objects in Ruby
  • Simple Form Hello Rails Application
  • Database Application using scaffold - [Video]
  • Session Management
  • Cookies Management in Ruby on Rails
  • File Uploads in Ruby on Rails
By Karthikeyan , 18 October, 2012

Hello Rails Application in Ruby on rails - Getting values from text boxes and radio buttons in a simple form and saving them to mysql database.

 

Model

user.rb

class User < ActiveRecord::Base
end

 

Controller

hello_controller.rb

class HelloController < ApplicationController
  def respond
    @user=User.new(params[:user])
    @user.save
  end
end

 

Views

index.html.erb

<% form_tag :action=>"respond" do%>

<%=text_field :user, :name%>

<%=text_field :user, :age%>

<%=radio_button :user, :color, :Blue%> Blue <%=radio_button :user, :color, :Green%>Green

<%=submit_tag "submit"%>

<%end%>

 

respond.html.rb

My name is <%[email protected]%>

My age is <%[email protected]%>

Your selected colour is <%[email protected]%>

See the below video to know how to work:
  • Add new comment

Comments

Featured Blog Posts

Convert Currency in Number to Words (Indian Rupees) - MS Excel
Foxpro Tutorial and Programs
Convert Currency in Number to Words in MS Word
Convert Currency in Number to Words (Indian Rupees) - Version 2
Best way to Use Rupee Symbol in Windows – Easy steps
Convert Currency in Number to Words - MS Access
Creating All in One Windows XP DVD with all Important Applications
RSS feed

© 2009-2025 Live to Learn.In

Terms of Use | Privacy Policy