Revision 1298:4f746d8966dd lib/plugins/classic_pagination/test/fixtures

View differences:

lib/plugins/classic_pagination/test/fixtures/companies.yml
1
thirty_seven_signals:
2
  id: 1
3
  name: 37Signals
4
  rating: 4
5

  
6
TextDrive:
7
  id: 2
8
  name: TextDrive
9
  rating: 4
10

  
11
PlanetArgon:
12
  id: 3
13
  name: Planet Argon
14
  rating: 4
15

  
16
Google:
17
  id: 4
18
  name: Google
19
  rating: 4
20
  
21
Ionist:
22
  id: 5
23
  name: Ioni.st
24
  rating: 4
lib/plugins/classic_pagination/test/fixtures/company.rb
1
class Company < ActiveRecord::Base
2
  attr_protected :rating
3
  set_sequence_name :companies_nonstd_seq
4

  
5
  validates_presence_of :name
6
  def validate
7
    errors.add('rating', 'rating should not be 2') if rating == 2
8
  end  
9
end
lib/plugins/classic_pagination/test/fixtures/developer.rb
1
class Developer < ActiveRecord::Base
2
  has_and_belongs_to_many :projects
3
end
4

  
5
class DeVeLoPeR < ActiveRecord::Base
6
  self.table_name = "developers"
7
end
lib/plugins/classic_pagination/test/fixtures/developers.yml
1
david:
2
  id: 1
3
  name: David
4
  salary: 80000
5

  
6
jamis:
7
  id: 2
8
  name: Jamis
9
  salary: 150000
10

  
11
<% for digit in 3..10 %>
12
dev_<%= digit %>:
13
  id: <%= digit %>
14
  name: fixture_<%= digit %>
15
  salary: 100000
16
<% end %>
17

  
18
poor_jamis:
19
  id: 11
20
  name: Jamis
21
  salary: 9000
lib/plugins/classic_pagination/test/fixtures/developers_projects.yml
1
david_action_controller:
2
  developer_id: 1
3
  project_id: 2
4
  joined_on: 2004-10-10
5

  
6
david_active_record:
7
  developer_id: 1
8
  project_id: 1
9
  joined_on: 2004-10-10
10

  
11
jamis_active_record:
12
  developer_id: 2
13
  project_id: 1
lib/plugins/classic_pagination/test/fixtures/project.rb
1
class Project < ActiveRecord::Base
2
  has_and_belongs_to_many :developers, :uniq => true
3
end
lib/plugins/classic_pagination/test/fixtures/projects.yml
1
action_controller:
2
  id: 2
3
  name: Active Controller
4

  
5
active_record:
6
  id: 1
7
  name: Active Record
lib/plugins/classic_pagination/test/fixtures/replies.yml
1
witty_retort:
2
  id: 1
3
  topic_id: 1
4
  content: Birdman is better!
5
  created_at: <%= 6.hours.ago.to_s(:db) %>
6
  updated_at: nil
7
  
8
another:
9
  id: 2
10
  topic_id: 2
11
  content: Nuh uh!
12
  created_at: <%= 1.hour.ago.to_s(:db) %>
13
  updated_at: nil
lib/plugins/classic_pagination/test/fixtures/reply.rb
1
class Reply < ActiveRecord::Base
2
  belongs_to :topic, :include => [:replies]
3
  
4
  validates_presence_of :content
5
end
lib/plugins/classic_pagination/test/fixtures/schema.sql
1
CREATE TABLE 'companies' (
2
  'id' INTEGER PRIMARY KEY NOT NULL,
3
  'name' TEXT DEFAULT NULL,
4
  'rating' INTEGER DEFAULT 1
5
);
6

  
7
CREATE TABLE 'replies' (
8
  'id' INTEGER PRIMARY KEY NOT NULL, 
9
  'content' text, 
10
  'created_at' datetime, 
11
  'updated_at' datetime, 
12
  'topic_id' integer
13
);
14

  
15
CREATE TABLE 'topics' (
16
  'id' INTEGER PRIMARY KEY NOT NULL, 
17
  'title' varchar(255), 
18
  'subtitle' varchar(255), 
19
  'content' text, 
20
  'created_at' datetime, 
21
  'updated_at' datetime
22
);
23

  
24
CREATE TABLE 'developers' (
25
  'id' INTEGER PRIMARY KEY NOT NULL,
26
  'name' TEXT DEFAULT NULL,
27
  'salary' INTEGER DEFAULT 70000,
28
  'created_at' DATETIME DEFAULT NULL,
29
  'updated_at' DATETIME DEFAULT NULL
30
);
31

  
32
CREATE TABLE 'projects' (
33
  'id' INTEGER PRIMARY KEY NOT NULL,
34
  'name' TEXT DEFAULT NULL
35
);
36

  
37
CREATE TABLE 'developers_projects' (
38
  'developer_id' INTEGER NOT NULL,
39
  'project_id' INTEGER NOT NULL,
40
  'joined_on' DATE DEFAULT NULL,
41
  'access_level' INTEGER DEFAULT 1
42
);
lib/plugins/classic_pagination/test/fixtures/topic.rb
1
class Topic < ActiveRecord::Base
2
  has_many :replies, :include => [:user], :dependent => :destroy
3
end
lib/plugins/classic_pagination/test/fixtures/topics.yml
1
futurama:
2
  id: 1
3
  title: Isnt futurama awesome?
4
  subtitle: It really is, isnt it.
5
  content: I like futurama
6
  created_at: <%= 1.day.ago.to_s(:db) %>
7
  updated_at:
8
  
9
harvey_birdman:
10
  id: 2
11
  title: Harvey Birdman is the king of all men
12
  subtitle: yup
13
  content: It really is
14
  created_at: <%= 2.hours.ago.to_s(:db) %>
15
  updated_at:
16

  
17
rails:
18
  id: 3
19
  title: Rails is nice
20
  subtitle: It makes me happy
21
  content: except when I have to hack internals to fix pagination. even then really.
22
  created_at: <%= 20.minutes.ago.to_s(:db) %>

Also available in: Unified diff