Rails how to add addtional info to columns ? Complicated problem
I want to be able to add additional information to some columns. I have tho开发者_如何学编程ught making a button "Add additional info" in my new form to each input field with some Jquery.
But how should I store this additional info? I have thought about creating a table named addinfos and store following: columninfo - The information added to the column
But it will not work because how should I make an association to the column?
UPDATE EDIT: Example I have a regular form:
<%= simple_form_for [@example], :html => { :multipart => true } do |f| %>
<%= f.input :name, :label => 'Navn' %>
<%= f.input :customers, :label => 'Customers' %>
<% end %>
The customers column is a integer. Example the there are 400.000 customers, but it is all over the world therefor I want to add this information to the column.
Example in the view:
I know how to make the tooltip and all the other stuff in view. But not how to store this data.
I think I have 2 options to do this:
Make an extra column for each column in the table. Example customersinfo, nameinfo which all would be varchar.
Create an new table named information which would have 1 column for each column in the example table. customersinfo, nameinfo, off course varchar. And example table would has_one :information, and information belongs_to :example
精彩评论