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

  • Home
  • SEARCH
  • 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 4236046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:35:11+00:00 2026-05-21T02:35:11+00:00

This is my first Rails project. For some reason, I can’t post to one

  • 0

This is my first Rails project. For some reason, I can’t post to one column in my database, although the other columns in the same table work out fine. (I also couldn’t populate that column using the Faker gem when I populated the other columns in the same table, so I just went into the database and filled them in by hand just so I could move past it.)

My database has a table “articles” with columns “id” “content” “user_id” “created_at” “updated_at” and “heading”. My form to create a new article is like this:

<%= form_for @article do |f| %>
  <div class="field">
    <%= f.text_field :heading, :size => "60x1" %>
  </div>
  <div class="field">
    <%= f.text_area :content, :size => "60x24" %>
  </div>
  <div class="actions">
    <%= f.submit "Submit" %>
  </div>
<% end %>

My articles_controller has:

def new
 @article = Article.new
end

def create
 if @article = current_user.articles.create!(params[:article])
   redirect_to root_path, :flash => { :success => "Article created!" }
 else
   redirect_to "/articles/new"
 end
end

When I try to submit the form, it either catches on my heading validation (:presence => true) or just submits without a heading if I comment out the validation. The post is sending these parameters:

{"utf8"=>"✓",
"authenticity_token"=>"...",
"article"=>{"heading"=>"Test heading",
"content"=>"Test content"},
"commit"=>"Submit"}

It looks like there’s a heading. All of the other columns get filled in, including user_id. Why doesn’t the heading get filled in? I have run rake db:migrate and also added reset_column_information to my migration:

def self.up
 add_column :articles, :heading, :string
 Article.reset_column_information
end

But it didn’t work either way.

Also, if I go into the rails console and add a new article that way, I can add a heading with no problem.

If it matters, I am using SQLite. I added the heading column in a later migration, could it be a problem that it comes last in the column order?

  • 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-21T02:35:12+00:00Added an answer on May 21, 2026 at 2:35 am

    I have been going over this for days and I actually just solved it as soon as I posted it. In my article.rb, I had:

    attr_accessible :content
    

    I had to change it to:

    attr_accessible :content, :heading
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on my first 'real' (as opposed to playing around) rails 3 project
I must first let you know that while I am an experienced rails developer,
I'm making a recipe-manager (who isn't as their first app?) in Rails, and here
I'm starting to use simple_form for a rails application, and while converting some of
I'm new to rails and am learning how to use it. I came across
I'd like to present a first-time user with a welcome message that appears until
So this is probably a fairly easy question to answer but here goes anyway.
I am all new to rails, however quite familiar with regular MVC programming like
My Rails 3 app has a User model and a Profile model. A User
I have a rails app that is combining javascript assets using Jammit , and

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.