Skip to content

Instantly share code, notes, and snippets.

@morshedalam
Last active August 29, 2015 14:19
Show Gist options
  • Save morshedalam/5ba61d19a6305a33a2fa to your computer and use it in GitHub Desktop.
Save morshedalam/5ba61d19a6305a33a2fa to your computer and use it in GitHub Desktop.
Table less model in Rails
module HasNoTable
extend ActiveSupport::Concern
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment