Permalink
Browse files

move assets and models

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 4979448 commit 43b81d01d0a175c76fea1cdad2484ceb64ca659b @jeremy jeremy committed Jan 18, 2008
Showing with 47 additions and 48 deletions.
  1. 0 activerecord/test/{fixtures → assets}/example.log
  2. 0 activerecord/test/{fixtures → assets}/flowers.jpg
  3. +2 −2 activerecord/test/{fixtures → models}/author.rb
  4. 0 activerecord/test/{fixtures → models}/auto_id.rb
  5. 0 activerecord/test/{fixtures → models}/binary.rb
  6. 0 activerecord/test/{fixtures → models}/book.rb
  7. 0 activerecord/test/{fixtures → models}/categorization.rb
  8. +5 −5 activerecord/test/{fixtures → models}/category.rb
  9. 0 activerecord/test/{fixtures → models}/citation.rb
  10. 0 activerecord/test/{fixtures → models}/column_name.rb
  11. +2 −2 activerecord/test/{fixtures → models}/comment.rb
  12. +6 −6 activerecord/test/{fixtures → models}/company.rb
  13. +3 −3 activerecord/test/{fixtures → models}/company_in_module.rb
  14. +0 −1 activerecord/test/{fixtures → models}/computer.rb
  15. +1 −1 activerecord/test/{fixtures → models}/contact.rb
  16. 0 activerecord/test/{fixtures → models}/course.rb
  17. +8 −8 activerecord/test/{fixtures → models}/customer.rb
  18. 0 activerecord/test/{fixtures → models}/default.rb
  19. +10 −10 activerecord/test/{fixtures → models}/developer.rb
  20. 0 activerecord/test/{fixtures → models}/edge.rb
  21. 0 activerecord/test/{fixtures → models}/entrant.rb
  22. 0 activerecord/test/{fixtures → models}/item.rb
  23. 0 activerecord/test/{fixtures → models}/joke.rb
  24. 0 activerecord/test/{fixtures → models}/keyboard.rb
  25. 0 activerecord/test/{fixtures → models}/legacy_thing.rb
  26. 0 activerecord/test/{fixtures → models}/matey.rb
  27. 0 activerecord/test/{fixtures → models}/minimalistic.rb
  28. 0 activerecord/test/{fixtures → models}/mixed_case_monkey.rb
  29. 0 activerecord/test/{fixtures → models}/movie.rb
  30. +2 −2 activerecord/test/{fixtures → models}/order.rb
  31. 0 activerecord/test/{fixtures → models}/parrot.rb
  32. 0 activerecord/test/{fixtures → models}/person.rb
  33. 0 activerecord/test/{fixtures → models}/pirate.rb
  34. +1 −1 activerecord/test/{fixtures → models}/post.rb
  35. 0 activerecord/test/{fixtures → models}/project.rb
  36. 0 activerecord/test/{fixtures → models}/reader.rb
  37. +4 −4 activerecord/test/{fixtures → models}/reply.rb
  38. 0 activerecord/test/{fixtures → models}/ship.rb
  39. 0 activerecord/test/{fixtures → models}/subject.rb
  40. 0 activerecord/test/{fixtures → models}/subscriber.rb
  41. 0 activerecord/test/{fixtures → models}/tag.rb
  42. 0 activerecord/test/{fixtures → models}/tagging.rb
  43. 0 activerecord/test/{fixtures → models}/task.rb
  44. +3 −3 activerecord/test/{fixtures → models}/topic.rb
  45. 0 activerecord/test/{fixtures → models}/treasure.rb
  46. 0 activerecord/test/{fixtures → models}/vertex.rb
  47. 0 activerecord/test/{fixtures → models}/warehouse_thing.rb
View
0 activerecord/test/fixtures/example.log → activerecord/test/assets/example.log
File renamed without changes.
View
0 activerecord/test/fixtures/flowers.jpg → activerecord/test/assets/flowers.jpg
File renamed without changes
View
4 activerecord/test/fixtures/author.rb → activerecord/test/models/author.rb
@@ -23,7 +23,7 @@ def testing_proxy_target
has_many :special_posts
has_many :special_post_comments, :through => :special_posts, :source => :comments
-
+
has_many :special_nonexistant_posts, :class_name => "SpecialPost", :conditions => "posts.body = 'nonexistant'"
has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => "comments.post_id = 0"
has_many :nonexistant_comments, :through => :posts
@@ -34,7 +34,7 @@ def testing_proxy_target
has_many :other_posts, :class_name => "Post"
has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding,
- :after_add => :log_after_adding,
+ :after_add => :log_after_adding,
:before_remove => :log_before_removing,
:after_remove => :log_after_removing
has_many :posts_with_proc_callbacks, :class_name => "Post",
View
0 activerecord/test/fixtures/auto_id.rb → activerecord/test/models/auto_id.rb
File renamed without changes.
View
0 activerecord/test/fixtures/binary.rb → activerecord/test/models/binary.rb
File renamed without changes.
View
0 activerecord/test/fixtures/book.rb → activerecord/test/models/book.rb
File renamed without changes.
View
0 activerecord/test/fixtures/categorization.rb → activerecord/test/models/categorization.rb
File renamed without changes.
View
10 activerecord/test/fixtures/category.rb → activerecord/test/models/category.rb
@@ -2,7 +2,7 @@ class Category < ActiveRecord::Base
has_and_belongs_to_many :posts
has_and_belongs_to_many :special_posts, :class_name => "Post"
has_and_belongs_to_many :other_posts, :class_name => "Post"
-
+
has_and_belongs_to_many(:select_testing_posts,
:class_name => 'Post',
:foreign_key => 'category_id',
@@ -12,15 +12,15 @@ class Category < ActiveRecord::Base
def self.what_are_you
'a category...'
end
-
+
has_many :categorizations
has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
end
class SpecialCategory < Category
-
+
def self.what_are_you
'a special category...'
- end
-
+ end
+
end
View
0 activerecord/test/fixtures/citation.rb → activerecord/test/models/citation.rb
File renamed without changes.
View
0 activerecord/test/fixtures/column_name.rb → activerecord/test/models/column_name.rb
File renamed without changes.
View
4 activerecord/test/fixtures/comment.rb → activerecord/test/models/comment.rb
@@ -1,10 +1,10 @@
class Comment < ActiveRecord::Base
belongs_to :post
-
+
def self.what_are_you
'a comment...'
end
-
+
def self.search_by_type(q)
self.find(:all, :conditions => ["#{QUOTED_TYPE} = ?", q])
end
View
12 activerecord/test/fixtures/company.rb → activerecord/test/models/company.rb
@@ -9,7 +9,7 @@ class Company < AbstractCompany
validates_presence_of :name
has_one :dummy_account, :foreign_key => "firm_id", :class_name => "Account"
-
+
def arbitrary_method
"I am Jack's profound disappointment"
end
@@ -74,12 +74,12 @@ def self.destroyed_client_ids
end
true
end
-
+
# Used to test that read and question methods are not generated for these attributes
def ruby_type
read_attribute :ruby_type
end
-
+
def rating?
query_attribute :rating
end
@@ -94,7 +94,7 @@ class VerySpecialClient < SpecialClient
class Account < ActiveRecord::Base
belongs_to :firm
-
+
def self.destroyed_account_ids
@destroyed_account_ids ||= Hash.new { |h,k| h[k] = [] }
end
@@ -105,8 +105,8 @@ def self.destroyed_account_ids
end
true
end
-
-
+
+
protected
def validate
errors.add_on_empty "credit_limit"
View
6 ...record/test/fixtures/company_in_module.rb → ...verecord/test/models/company_in_module.rb
@@ -3,7 +3,7 @@ module Business
class Company < ActiveRecord::Base
attr_protected :rating
end
-
+
class Firm < Company
has_many :clients, :order => "id", :dependent => :destroy
has_many :clients_sorted_desc, :class_name => "Client", :order => "id DESC"
@@ -18,12 +18,12 @@ class Client < Company
belongs_to :firm, :foreign_key => "client_of"
belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of"
end
-
+
class Developer < ActiveRecord::Base
has_and_belongs_to_many :projects
validates_length_of :name, :within => (3..20)
end
-
+
class Project < ActiveRecord::Base
has_and_belongs_to_many :developers
end
View
1 activerecord/test/fixtures/computer.rb → activerecord/test/models/computer.rb
@@ -1,4 +1,3 @@
class Computer < ActiveRecord::Base
belongs_to :developer, :foreign_key=>'developer'
end
-
View
2 activerecord/test/fixtures/contact.rb → activerecord/test/models/contact.rb
@@ -11,6 +11,6 @@ def self.column(name, sql_type = nil, options = {})
column :created_at, :datetime
column :awesome, :boolean
column :preferences, :string
-
+
serialize :preferences
end
View
0 activerecord/test/fixtures/course.rb → activerecord/test/models/course.rb
File renamed without changes.
View
16 activerecord/test/fixtures/customer.rb → activerecord/test/models/customer.rb
@@ -10,41 +10,41 @@ class Address
def initialize(street, city, country)
@street, @city, @country = street, city, country
end
-
+
def close_to?(other_address)
city == other_address.city && country == other_address.country
end
def ==(other)
other.is_a?(self.class) && other.street == street && other.city == city && other.country == country
- end
+ end
end
class Money
attr_reader :amount, :currency
-
+
EXCHANGE_RATES = { "USD_TO_DKK" => 6, "DKK_TO_USD" => 0.6 }
-
+
def initialize(amount, currency = "USD")
@amount, @currency = amount, currency
end
-
+
def exchange_to(other_currency)
Money.new((amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor, other_currency)
end
end
class GpsLocation
attr_reader :gps_location
-
+
def initialize(gps_location)
@gps_location = gps_location
end
-
+
def latitude
gps_location.split("x").first
end
-
+
def longitude
gps_location.split("x").last
end
View
0 activerecord/test/fixtures/default.rb → activerecord/test/models/default.rb
File renamed without changes.
View
20 activerecord/test/fixtures/developer.rb → activerecord/test/models/developer.rb
@@ -16,22 +16,22 @@ def find_most_recent
find(:first, :order => "id DESC")
end
end
-
- has_and_belongs_to_many :projects_extended_by_name,
- :class_name => "Project",
- :join_table => "developers_projects",
+
+ has_and_belongs_to_many :projects_extended_by_name,
+ :class_name => "Project",
+ :join_table => "developers_projects",
:association_foreign_key => "project_id",
:extend => DeveloperProjectsAssociationExtension
- has_and_belongs_to_many :projects_extended_by_name_twice,
- :class_name => "Project",
- :join_table => "developers_projects",
+ has_and_belongs_to_many :projects_extended_by_name_twice,
+ :class_name => "Project",
+ :join_table => "developers_projects",
:association_foreign_key => "project_id",
:extend => [DeveloperProjectsAssociationExtension, DeveloperProjectsAssociationExtension2]
- has_and_belongs_to_many :projects_extended_by_name_and_block,
- :class_name => "Project",
- :join_table => "developers_projects",
+ has_and_belongs_to_many :projects_extended_by_name_and_block,
+ :class_name => "Project",
+ :join_table => "developers_projects",
:association_foreign_key => "project_id",
:extend => DeveloperProjectsAssociationExtension do
def find_least_recent
View
0 activerecord/test/fixtures/edge.rb → activerecord/test/models/edge.rb
File renamed without changes.
View
0 activerecord/test/fixtures/entrant.rb → activerecord/test/models/entrant.rb
File renamed without changes.
View
0 activerecord/test/fixtures/item.rb → activerecord/test/models/item.rb
File renamed without changes.
View
0 activerecord/test/fixtures/joke.rb → activerecord/test/models/joke.rb
File renamed without changes.
View
0 activerecord/test/fixtures/keyboard.rb → activerecord/test/models/keyboard.rb
File renamed without changes.
View
0 activerecord/test/fixtures/legacy_thing.rb → activerecord/test/models/legacy_thing.rb
File renamed without changes.
View
0 activerecord/test/fixtures/matey.rb → activerecord/test/models/matey.rb
File renamed without changes.
View
0 activerecord/test/fixtures/minimalistic.rb → activerecord/test/models/minimalistic.rb
File renamed without changes.
View
0 ...record/test/fixtures/mixed_case_monkey.rb → ...verecord/test/models/mixed_case_monkey.rb
File renamed without changes.
View
0 activerecord/test/fixtures/movie.rb → activerecord/test/models/movie.rb
File renamed without changes.
View
4 activerecord/test/fixtures/order.rb → activerecord/test/models/order.rb
@@ -1,4 +1,4 @@
class Order < ActiveRecord::Base
- belongs_to :billing, :class_name => 'Customer', :foreign_key => 'billing_customer_id'
- belongs_to :shipping, :class_name => 'Customer', :foreign_key => 'shipping_customer_id'
+ belongs_to :billing, :class_name => 'Customer', :foreign_key => 'billing_customer_id'
+ belongs_to :shipping, :class_name => 'Customer', :foreign_key => 'shipping_customer_id'
end
View
0 activerecord/test/fixtures/parrot.rb → activerecord/test/models/parrot.rb
File renamed without changes.
View
0 activerecord/test/fixtures/person.rb → activerecord/test/models/person.rb
File renamed without changes.
View
0 activerecord/test/fixtures/pirate.rb → activerecord/test/models/pirate.rb
File renamed without changes.
View
2 activerecord/test/fixtures/post.rb → activerecord/test/models/post.rb
@@ -28,7 +28,7 @@ def add_joins_and_select
:joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id'
end
end
-
+
has_many :funky_tags, :through => :taggings, :source => :tag
has_many :super_tags, :through => :taggings
has_one :tagging, :as => :taggable
View
0 activerecord/test/fixtures/project.rb → activerecord/test/models/project.rb
File renamed without changes.
View
0 activerecord/test/fixtures/reader.rb → activerecord/test/models/reader.rb
File renamed without changes.
View
8 activerecord/test/fixtures/reply.rb → activerecord/test/models/reply.rb
@@ -6,20 +6,20 @@ class Reply < Topic
validate :errors_on_empty_content
validate_on_create :title_is_wrong_create
-
+
attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read
def validate
errors.add("title", "Empty") unless attribute_present? "title"
end
-
+
def errors_on_empty_content
errors.add("content", "Empty") unless attribute_present? "content"
end
-
+
def validate_on_create
if attribute_present?("title") && attribute_present?("content") && content == "Mismatch"
- errors.add("title", "is Content Mismatch")
+ errors.add("title", "is Content Mismatch")
end
end
View
0 activerecord/test/fixtures/ship.rb → activerecord/test/models/ship.rb
File renamed without changes.
View
0 activerecord/test/fixtures/subject.rb → activerecord/test/models/subject.rb
File renamed without changes.
View
0 activerecord/test/fixtures/subscriber.rb → activerecord/test/models/subscriber.rb
File renamed without changes.
View
0 activerecord/test/fixtures/tag.rb → activerecord/test/models/tag.rb
File renamed without changes.
View
0 activerecord/test/fixtures/tagging.rb → activerecord/test/models/tagging.rb
File renamed without changes.
View
0 activerecord/test/fixtures/task.rb → activerecord/test/models/task.rb
File renamed without changes.
View
6 activerecord/test/fixtures/topic.rb → activerecord/test/models/topic.rb
@@ -1,19 +1,19 @@
class Topic < ActiveRecord::Base
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id"
serialize :content
-
+
before_create :default_written_on
before_destroy :destroy_children
def parent
Topic.find(parent_id)
end
-
+
# trivial method for testing Array#to_xml with :methods
def topic_id
id
end
-
+
protected
def approved=(val)
View
0 activerecord/test/fixtures/treasure.rb → activerecord/test/models/treasure.rb
File renamed without changes.
View
0 activerecord/test/fixtures/vertex.rb → activerecord/test/models/vertex.rb
File renamed without changes.
View
0 ...verecord/test/fixtures/warehouse_thing.rb → activerecord/test/models/warehouse_thing.rb
File renamed without changes.

0 comments on commit 43b81d0

Please sign in to comment.