Skip to content

Instantly share code, notes, and snippets.

@kirs
Created April 7, 2016 21:21
Show Gist options
  • Save kirs/64cf869c981e1b8eb1c98512cd452149 to your computer and use it in GitHub Desktop.
Save kirs/64cf869c981e1b8eb1c98512cd452149 to your computer and use it in GitHub Desktop.
require 'bundler/setup'
require 'active_record'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Schema.define do
create_table "users" do |t|
t.string "name"
end
end
class User < ActiveRecord::Base
private
def name=(value)
super
end
end
user = User.new(name: "kir")
# unknown attribute 'name' for User. (ActiveModel::UnknownAttributeError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment