开发者

rails3 migration to add new column does not save values to table

开发者 https://www.devze.com 2023-02-19 23:13 出处:网络
So, I created the following migration: class AddAclToUsers < ActiveRecord::Migration def self.up add_column :users, :acl, :integer

So, I created the following migration:

class AddAclToUsers < ActiveRecord::Migration
  def self.up
    add_column :users, :acl, :integer
  end

  def self.down
    remove_column :users, :acl
  end
end

however, after modifying the various erb files in the view, values entered in edit.html.erb are not saved to the database.

I can manually start SQlite3 and select * the table and see开发者_如何学编程 that the column was created but no values are entered. I can also manually UPDATE or INSERT numbers into the new column which the controller queries and displays correctly.

Any suggestions on what may be wrong with the frameworks udate/save??

-daniel


Please check if there is a list of attr_accessible in your User model. If you are using Devise like gem/plugin for authentication you would have a list of attr_accessible in the model.

Add new attribute (acl in your case) to the attr_accessible list.

If this is not the case, I would like you to paste your view, controller and model code

0

精彩评论

暂无评论...
验证码 换一张
取 消