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 418575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:41:32+00:00 2026-05-12T18:41:32+00:00

I have a database with tables. I want to create a model in my

  • 0

I have a database with tables. I want to create a model in my Rails app from existing table. As i know, such functionality is available, and is done as follows:

script/generate scaffold model_name --skip-migration

Of course, i defined my database in database.yml file. Scaffold generated for me a model with controller and views. My table name is not as it must be for Rails(it is incorrect, not following conventions), i added set_table_name to my controller. But, when i am calling the index method, on my page i have only set of # symbols, but not a data from database. In my index.html.erb i have only generated code by scaffold. How can i print out my database data?

  • 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-05-12T18:41:32+00:00Added an answer on May 12, 2026 at 6:41 pm

    Have you generated a schema file from your existing database? If you run the command

    rake db:schema:dump
    

    and then re-generate your scaffold this should fix the problem.

    Additionally you may wish to check out Dr Nic’s Magic Model generator. This will generate models for all of your existing tables and attempt to guess the relationships. This will probably not work if your table naming is not understandable by rails.

    UPDATE

    I do not generally use the default scaffold however I have tested this myself and it appears that if you skip the migration and do not pass any column name/type pairs then the scaffold generator will not create anything in the template to render the columns.

    You have two choices here either

    1. Pass in the column name pairs as well as skip-migration or
    2. Download Ryan Bates Nifty Scaffold generator which will create the scaffold with the column names even if you specify –skip-migration
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table named Categories . I want to create a form
I have a PostGreSQL database with the following data model: CREATE TABLE staff (s_id
I have a table in my database for which I want to create a
I have a database with three tables: user_table country_table city_table I want to write
I have a database table with some rows that I want to fetch using
We have a database where every table name starts with WW. I want to
I have a DataTable which I want to save to a SQLite Database Table.
i have a stack of messages in database table. i want to send these
I have 3 columns in Oracle database having table mytable and i want records
I have a simple database named customer with a single table data.I want to

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.