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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:44:00+00:00 2026-06-03T18:44:00+00:00

ive got a problem with my database in that it only seems to be

  • 0

ive got a problem with my database in that it only seems to be storing the id of new entries and displaying those in my form instead of the :name attribute that im asking for. If I view the entry either using my form or via a sqlite3 browser. Only the ID is showing.

Here’s my migration file..

class CreateClients < ActiveRecord::Migration
  def change
    create_table :clients do |t|
      t.string :name
      t.string :detail
      t.string :more_detail
      t.string :more_details

      t.timestamps
    end
  end
end

My form..

<%= form_for @client, :html => { :class => 'form-horizontal' } do |f| %>
  <div class="control-group">
    <%= f.label :name, :class => 'control-label' %>
    <div class="controls">
      <%= f.text_field :name, :class => 'text_field' %>
    </div>
  </div>
  <div class="control-group">
    <%= f.label :detail, :class => 'control-label' %>
    <div class="controls">
      <%= f.text_field :detail, :class => 'text_field' %>
    </div>
  </div>
  <div class="control-group">
    <%= f.label :more_detail, :class => 'control-label' %>
    <div class="controls">
      <%= f.text_field :more_detail, :class => 'text_field' %>
    </div>
  </div>
  <div class="control-group">
    <%= f.label :more_details, :class => 'control-label' %>
    <div class="controls">
      <%= f.text_field :more_details, :class => 'text_field' %>
    </div>
  </div>

  <div class="form-actions">
    <%= f.submit nil, :class => 'btn btn-primary' %>
    <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
                clients_path, :class => 'btn' %>
  </div>
<% end %>

And my view..

 ...
   <% @client.each do |client| %>
      <tr>
        <td><%= link_to client.name, client_path(client) %></td>
        <td>
      ...

Instead of showing the name (eg foo) and then a link to that clients details. It’s showing me /clients/3 and when I click on it, it’s taking me to a page with empty name annd detail’s fields even though they were specified when saving the entry.

If I use a sqlite3 browser. I can see the entrys have been saved but each has a null value for all columns except ID.

  • 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-03T18:44:04+00:00Added an answer on June 3, 2026 at 6:44 pm

    I think I know what your problem is. The latest Rails version has attribute protection from mass assignment by default, so you need to specify which attributes you want to be accessible from outside the model like this:

    class Client < ActiveRecord::Base 
      attr_accessible :name, :detail, :more_detail
    end
    

    Read this section of the security guide.
    P.S.: Did the console throw any errors when you are creating a new record?

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

Sidebar

Related Questions

I've got a links array that I'm saving to a database. The problem is
Ive got this problem: Line 20 (LOOT_FromContainer(container) I need that to use as Invoke
I've got a form that allows the user to edit an employees information: name,
I've got times saved in a sql database in utc format. I'm displaying those
I've got a problem in my database - somehow changes sometimes are not being
I've got problem with connecting to MySQL database on my freshly installed Windows 7
I've got a "little" problem. A week ago my database was reaching full disk
Ive got the following problem. I have a model called user which has a
got a problem with dets:to_ets/2 Could somebody point me to an example online? Ive
I've got a problem with ProFTPD on Debian. I use users from MySQL database

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.