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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:03:48+00:00 2026-05-27T04:03:48+00:00

To begin with, I must say that I am VERY new to Ruby on

  • 0

To begin with, I must say that I am VERY new to Ruby on Rails. I’ve only been working my way through it for about a week.

I’ve starting integrating my existing website onto a blog I made which uses two resources – posts and comments.

My problem resides with the posts resource. I made the posts resource using “generate scaffold”, to give me the fields “Title” and “Content”, however I would now like to add another field “Image”, which takes a local url of an image to add to the blog.

I’ve gone through manually and added references to the new “Image” field, adding it as a string with the intention of using the string as a target in an image_tag when it need to be displayed.
However when I visit pages that use the form to add or edit posts, I’m given the following error:

NoMethodError in Posts#new
undefined method `image' for #<Post:0x39a4868>

Is there an automated, catch-all way of adding a new field to a pre-existing resource?

Any help would be appreciated.

  • 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-27T04:03:49+00:00Added an answer on May 27, 2026 at 4:03 am

    You need to generate a migration.

    rails g migration add_image_to_posts image:string
    

    Which will generate a file in db/migrate

    You can then run this migration with:

    rake db:migrate
    

    And you should now have an image field in your model.

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

Sidebar

Related Questions

So, I must say that I am completely new to symfony, i've been using
I'm new to LaTeX and I must say that I am really struggling with
To begin, I must say that I have searched for quite a long time
To begin with, let me say that I understand how and why the problem
i must say im new to win32 c++ programming so i face a problem
So I've fooled around with WPF a bit recently, and I must say that
first i must admit that i'm not very familiar with sql server's recursive CTE's
To begin with, I'm not even sure, if it is the right way to
To begin with, I don't know the first thing about Python ... so I
I have to implement a function that takes an iterator. The iterator must dereference

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.