Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Rails scaffolding

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 187
    Comment on it

    Rails scaffold can create the models, views, and controllers for a new resource in a single operation.
    Scaffold Would create a full CRUD (create, read, update, delete) for a table.
    Scaffold auto generate all the codes that rails needs. Later we can alter the code based on our requirements.
    Lets generate a scaffold using the scaffold helper script  given below :

    rails generate scaffold user name:string address:string

    After this we can see that all the major parts like model, view , controller etc.So we can call:

    rake db:migrate

    Now start the server:

    Rails s

    Now, open a browser and navigate to "http://localhost:3000/users/new". This will provide you a screen to create new entries in the Users table.
    Once you click the Create button , your record is added into the users table.
    To see the saved record navigate to "http://localhost:3000/users/1 ".
    You will see edit, show, and destroy options on this page.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: