RubyFlow The Ruby and Rails community linklog

Create temporary ActiveRecord models with Temping

Temping allows for the creation of temporary table-backed ActiveRecord models for use in tests. This is useful when writing ActiveRecord-extending plugins or for testing modules separate from their concrete implementations. The syntax for creating a model allows for any method call that can occur in a standard ActiveRecord::Base Model:

create_model :tests do   with_columns do |t|      t.string :test_string   end

  validates_presence_of :test_string end</code>

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in