Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (37 sloc) 0.951 kB
4241c40 @madebydna initial commit
madebydna authored
1 require 'active_model'
2 require 'active_record'
3 require 'action_controller'
4 require 'action_view'
5 require 'action_view/template'
6
7 require 'nested_form/view_helper'
8 require 'nested_form/builder'
9
10 Rspec.configure do |config|
11 config.mock_with :rr
12 end
13
14 class TablelessModel < ActiveRecord::Base
15 def self.columns() @columns ||= []; end
16
17 def self.column(name, sql_type = nil, default = nil, null = true)
18 columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
19 end
20
21 def self.quoted_table_name
22 name.pluralize.underscore
23 end
24
25 def quoted_id
26 "0"
27 end
28 end
29
30 class Project < TablelessModel
31 column :name, :string
32 has_many :tasks
33 accepts_nested_attributes_for :tasks
34 end
35
36 class Task < TablelessModel
37 column :project_id, :integer
38 column :name, :string
39 belongs_to :project
40 end
41
42 class Milestone < TablelessModel
43 column :task_id, :integer
44 column :name, :string
45 belongs_to :task
46 end
Something went wrong with that request. Please try again.