Initial commit of foodsoft 2
This commit is contained in:
commit
5b9a7e05df
657 changed files with 70444 additions and 0 deletions
3
vendor/plugins/will_paginate/test/fixtures/admin.rb
vendored
Normal file
3
vendor/plugins/will_paginate/test/fixtures/admin.rb
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class Admin < User
|
||||
has_many :companies, :finder_sql => 'SELECT * FROM companies'
|
||||
end
|
||||
13
vendor/plugins/will_paginate/test/fixtures/developer.rb
vendored
Normal file
13
vendor/plugins/will_paginate/test/fixtures/developer.rb
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class Developer < User
|
||||
has_and_belongs_to_many :projects, :include => :topics, :order => 'projects.name'
|
||||
|
||||
def self.with_poor_ones(&block)
|
||||
with_scope :find => { :conditions => ['salary <= ?', 80000], :order => 'salary' } do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
named_scope :poor, :conditions => ['salary <= ?', 80000], :order => 'salary'
|
||||
|
||||
def self.per_page() 10 end
|
||||
end
|
||||
13
vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
vendored
Normal file
13
vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
david_action_controller:
|
||||
developer_id: 1
|
||||
project_id: 2
|
||||
joined_on: 2004-10-10
|
||||
|
||||
david_active_record:
|
||||
developer_id: 1
|
||||
project_id: 1
|
||||
joined_on: 2004-10-10
|
||||
|
||||
jamis_active_record:
|
||||
developer_id: 2
|
||||
project_id: 1
|
||||
15
vendor/plugins/will_paginate/test/fixtures/project.rb
vendored
Normal file
15
vendor/plugins/will_paginate/test/fixtures/project.rb
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class Project < ActiveRecord::Base
|
||||
has_and_belongs_to_many :developers, :uniq => true
|
||||
|
||||
has_many :topics
|
||||
# :finder_sql => 'SELECT * FROM topics WHERE (topics.project_id = #{id})',
|
||||
# :counter_sql => 'SELECT COUNT(*) FROM topics WHERE (topics.project_id = #{id})'
|
||||
|
||||
has_many :replies, :through => :topics do
|
||||
def find_recent(params = {})
|
||||
with_scope :find => { :conditions => ['replies.created_at > ?', 15.minutes.ago] } do
|
||||
find :all, params
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
6
vendor/plugins/will_paginate/test/fixtures/projects.yml
vendored
Normal file
6
vendor/plugins/will_paginate/test/fixtures/projects.yml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
active_record:
|
||||
id: 1
|
||||
name: Active Record
|
||||
action_controller:
|
||||
id: 2
|
||||
name: Active Controller
|
||||
29
vendor/plugins/will_paginate/test/fixtures/replies.yml
vendored
Normal file
29
vendor/plugins/will_paginate/test/fixtures/replies.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
witty_retort:
|
||||
id: 1
|
||||
topic_id: 1
|
||||
content: Birdman is better!
|
||||
created_at: <%= 6.hours.ago.to_s(:db) %>
|
||||
|
||||
another:
|
||||
id: 2
|
||||
topic_id: 2
|
||||
content: Nuh uh!
|
||||
created_at: <%= 1.hour.ago.to_s(:db) %>
|
||||
|
||||
spam:
|
||||
id: 3
|
||||
topic_id: 1
|
||||
content: Nice site!
|
||||
created_at: <%= 1.hour.ago.to_s(:db) %>
|
||||
|
||||
decisive:
|
||||
id: 4
|
||||
topic_id: 4
|
||||
content: "I'm getting to the bottom of this"
|
||||
created_at: <%= 30.minutes.ago.to_s(:db) %>
|
||||
|
||||
brave:
|
||||
id: 5
|
||||
topic_id: 4
|
||||
content: "AR doesn't scare me a bit"
|
||||
created_at: <%= 10.minutes.ago.to_s(:db) %>
|
||||
7
vendor/plugins/will_paginate/test/fixtures/reply.rb
vendored
Normal file
7
vendor/plugins/will_paginate/test/fixtures/reply.rb
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class Reply < ActiveRecord::Base
|
||||
belongs_to :topic, :include => [:replies]
|
||||
|
||||
named_scope :recent, :conditions => ['replies.created_at > ?', 15.minutes.ago]
|
||||
|
||||
validates_presence_of :content
|
||||
end
|
||||
38
vendor/plugins/will_paginate/test/fixtures/schema.rb
vendored
Normal file
38
vendor/plugins/will_paginate/test/fixtures/schema.rb
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
ActiveRecord::Schema.define do
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.column "name", :text
|
||||
t.column "salary", :integer, :default => 70000
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
t.column "type", :text
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.column "name", :text
|
||||
end
|
||||
|
||||
create_table "developers_projects", :id => false, :force => true do |t|
|
||||
t.column "developer_id", :integer, :null => false
|
||||
t.column "project_id", :integer, :null => false
|
||||
t.column "joined_on", :date
|
||||
t.column "access_level", :integer, :default => 1
|
||||
end
|
||||
|
||||
create_table "topics", :force => true do |t|
|
||||
t.column "project_id", :integer
|
||||
t.column "title", :string
|
||||
t.column "subtitle", :string
|
||||
t.column "content", :text
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
end
|
||||
|
||||
create_table "replies", :force => true do |t|
|
||||
t.column "content", :text
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
t.column "topic_id", :integer
|
||||
end
|
||||
|
||||
end
|
||||
6
vendor/plugins/will_paginate/test/fixtures/topic.rb
vendored
Normal file
6
vendor/plugins/will_paginate/test/fixtures/topic.rb
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Topic < ActiveRecord::Base
|
||||
has_many :replies, :dependent => :destroy, :order => 'replies.created_at DESC'
|
||||
belongs_to :project
|
||||
|
||||
named_scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%']
|
||||
end
|
||||
30
vendor/plugins/will_paginate/test/fixtures/topics.yml
vendored
Normal file
30
vendor/plugins/will_paginate/test/fixtures/topics.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
futurama:
|
||||
id: 1
|
||||
title: Isnt futurama awesome?
|
||||
subtitle: It really is, isnt it.
|
||||
content: I like futurama
|
||||
created_at: <%= 1.day.ago.to_s(:db) %>
|
||||
updated_at:
|
||||
|
||||
harvey_birdman:
|
||||
id: 2
|
||||
title: Harvey Birdman is the king of all men
|
||||
subtitle: yup
|
||||
content: He really is
|
||||
created_at: <%= 2.hours.ago.to_s(:db) %>
|
||||
updated_at:
|
||||
|
||||
rails:
|
||||
id: 3
|
||||
project_id: 1
|
||||
title: Rails is nice
|
||||
subtitle: It makes me happy
|
||||
content: except when I have to hack internals to fix pagination. even then really.
|
||||
created_at: <%= 20.minutes.ago.to_s(:db) %>
|
||||
|
||||
ar:
|
||||
id: 4
|
||||
project_id: 1
|
||||
title: ActiveRecord sometimes freaks me out
|
||||
content: "I mean, what's the deal with eager loading?"
|
||||
created_at: <%= 15.minutes.ago.to_s(:db) %>
|
||||
2
vendor/plugins/will_paginate/test/fixtures/user.rb
vendored
Normal file
2
vendor/plugins/will_paginate/test/fixtures/user.rb
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class User < ActiveRecord::Base
|
||||
end
|
||||
35
vendor/plugins/will_paginate/test/fixtures/users.yml
vendored
Normal file
35
vendor/plugins/will_paginate/test/fixtures/users.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
david:
|
||||
id: 1
|
||||
name: David
|
||||
salary: 80000
|
||||
type: Developer
|
||||
|
||||
jamis:
|
||||
id: 2
|
||||
name: Jamis
|
||||
salary: 150000
|
||||
type: Developer
|
||||
|
||||
<% for digit in 3..10 %>
|
||||
dev_<%= digit %>:
|
||||
id: <%= digit %>
|
||||
name: fixture_<%= digit %>
|
||||
salary: 100000
|
||||
type: Developer
|
||||
<% end %>
|
||||
|
||||
poor_jamis:
|
||||
id: 11
|
||||
name: Jamis
|
||||
salary: 9000
|
||||
type: Developer
|
||||
|
||||
admin:
|
||||
id: 12
|
||||
name: admin
|
||||
type: Admin
|
||||
|
||||
goofy:
|
||||
id: 13
|
||||
name: Goofy
|
||||
type: Admin
|
||||
Loading…
Add table
Add a link
Reference in a new issue