Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:34:27+00:00 2026-06-11T21:34:27+00:00

I am new to Rails , i am trying to learn this technology ,

  • 0

I am new to Rails , i am trying to learn this technology , so please excuse if the question is dumb .

I am using Rails 3 .

Please let me know how can i insert a Record in the Database .

I am uisng postgresql , and below is my Table structure for the Students Table .

SELECT column_name FROM information_schema.columns WHERE table_name ='Students';

 column_name
-------------
 id
 name
 age
 description
(4 rows)

This is my Controller file student_controller.rb

class StudentController < ApplicationController

  def new
  end

end

This is my Model file student.rb

class Student < ActiveRecord::Base

end

This is my view file under \app\views\student\new.html.erb

<h1>BookController#new</h1>
<form>
  Id: <input type="text" name="id" /><br />
 Last Name: <input type="text" name="lastname" />
  Age: <input type="text" name="age" />
  Desciption: <input type="text" name="description" />
</form>

When i access http://localhost:3000/student/new

Please let me know how can i insert a Record in Database ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:34:28+00:00Added an answer on June 11, 2026 at 9:34 pm

    Do you understand about RESTful? I assume that you know it, unless you can find it in rails guide (In form tag, you must add @student,:action => :new, :method => :post)
    To add new record, just type Student.create(:name=> "a", :age => 2)
    This statement is composed of 2 sentences

    object = Student.new(:name => "a", :age => 2)
    object.save
    

    I suggest you use rails generate scaffold Student instead create everything like this. And then, read these generate code in controller, views, you will understand very deeply!:)
    P/s: i am an amateur too:D

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Rails and I'm trying to learn it using Rails 3 (RC).
First off, let me start by saying, I know this exact question has been
I'm trying to build a new Rails app with MongoDB using Mongoid as the
I have an odd question. Let's assume I create something using scaffolding. This should
I'm trying to model a card game in order to learn Rails. This is
So, I'm new at this and trying to learn by jumping right in. I
I am still very new to programming and trying to learn with rails. I
I am trying to start a new Rails project but I am getting a
I'm new to ruby/rails and trying to build a simple Projects / Tags app
I'm trying to put some specs around a new rails 3 project I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.