DangerousAttributeError in OmniAuth Railscast Tutorial: create is defined by ActiveRecord

后端 未结 4 752
Happy的楠姐
Happy的楠姐 2021-01-18 01:25

I\'ve looked at ActiveRecord::DangerousAttributeError and other similar threads on SO, but they don\'t address the same issue.

I\'m following the omniauth tutorial:

4条回答
  •  礼貌的吻别
    2021-01-18 02:12

    So just to finish the question off you will need to create a migration using this command:

    rails g migration remove_silly_authentication_fields_which_should_not_be_there
    

    Which looks something like this:

    class DropSillyControllerAttributes < ActiveRecord::Migration
       def change
          remove_column :authentications, :index
          remove_column :authentications, :create
          remove_column :authentications, :destroy
       end
    end
    

    And run it using the usual:

    rake db:migration
    

    Or alternatively you should be able to run:

    rake db:rollback
    

    To roll back the changes just made to the database and:

    rails d scaffold authentication
    

    To remove all the files, then run:

    rails g scaffold authentication user_id:integer provider:string uid:string
    

    And do the other stuff manually

    I did exactly the same thing myself by the way.

提交回复
热议问题