Skip to content

Commit

Permalink
Added annotations for the models, easier to keep track
Browse files Browse the repository at this point in the history
  • Loading branch information
seivan committed Dec 8, 2009
1 parent ec27826 commit 96909b2
Show file tree
Hide file tree
Showing 23 changed files with 344 additions and 20 deletions.
19 changes: 19 additions & 0 deletions app/models/bookmark.rb
@@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: bookmarks
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# description :string(255)
# permalink :string(255)
# user_id :integer(4)
# language_id :integer(4)
# thumb_file_name :string(255)
# thumb_content_type :string(255)
# thumb_file_size :string(255)
# thumb_updated_at :datetime
# created_at :datetime
# updated_at :datetime
#

class Bookmark < ActiveRecord::Base
belongs_to :language
belongs_to :user
Expand Down
14 changes: 14 additions & 0 deletions app/models/bookmark_import.rb
@@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: bookmark_imports
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# user_id :integer(4)
# description :string(255)
# language_id :integer(4)
# created_at :datetime
# updated_at :datetime
#

class BookmarkImport < ActiveRecord::Base
belongs_to :language
belongs_to :user
Expand Down
15 changes: 15 additions & 0 deletions app/models/comment.rb
@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: comments
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# bookmark_id :integer(4)
# language_id :integer(4)
# title :string(255)
# body :text
# importance :string(255)
# created_at :datetime
# updated_at :datetime
#

class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :bookmark
Expand Down
11 changes: 11 additions & 0 deletions app/models/flag.rb
@@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: flags
#
# id :integer(4) not null, primary key
# bookmark_id :integer(4) not null
# reason :string(255) not null
# created_at :datetime
# updated_at :datetime
#

class Flag < ActiveRecord::Base
belongs_to :flaggable, :polymorphic => true
end
14 changes: 14 additions & 0 deletions app/models/jot.rb
@@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: jots
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# language_id :integer(4)
# private :boolean(1)
# code :text
# error :text
# created_at :datetime
# updated_at :datetime
#

class Jot < ActiveRecord::Base
attr_accessible :code, :error, :language_id
belongs_to :language
Expand Down
11 changes: 11 additions & 0 deletions app/models/language.rb
@@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: languages
#
# id :integer(4) not null, primary key
# name :string(255)
# permalink :string(255)
# created_at :datetime
# updated_at :datetime
#

class Language < ActiveRecord::Base
has_many :bookmarks
has_many :bookmark_imports
Expand Down
29 changes: 29 additions & 0 deletions app/models/user.rb
@@ -1,3 +1,32 @@
# == Schema Information
#
# Table name: users
#
# id :integer(4) not null, primary key
# login :string(255) not null
# email :string(255) not null
# firstname :string(255) not null
# lastname :string(255) not null
# nickname :string(255) not null
# admin :boolean(1)
# crypted_password :string(255) not null
# password_salt :string(255) not null
# persistence_token :string(255) not null
# single_access_token :string(255) not null
# perishable_token :string(255) not null
# login_count :integer(4) default(0), not null
# failed_login_count :integer(4) default(0), not null
# last_request_at :datetime
# current_login_at :datetime
# last_login_at :datetime
# current_login_ip :string(255)
# last_login_ip :string(255)
# created_at :datetime
# updated_at :datetime
# landing_page :integer(4) default(0)
# active :boolean(1)
#

class User < ActiveRecord::Base
has_many :bookmarks
has_many :bookmark_imports
Expand Down
14 changes: 0 additions & 14 deletions db/schema.rb
Expand Up @@ -75,20 +75,6 @@

add_index "languages", ["name"], :name => "index_languages_on_name", :unique => true

create_table "report_caches", :force => true do |t|
t.string "model_name", :null => false
t.string "report_name", :null => false
t.string "grouping", :null => false
t.string "aggregation", :null => false
t.float "value", :default => 0.0, :null => false
t.datetime "reporting_period", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "report_caches", ["model_name", "report_name", "grouping", "aggregation", "reporting_period"], :name => "name_model_grouping_aggregation_period", :unique => true
add_index "report_caches", ["model_name", "report_name", "grouping", "aggregation"], :name => "name_model_grouping_agregation"

create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/bookmark_imports.yml
@@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: bookmark_imports
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# user_id :integer(4)
# description :string(255)
# language_id :integer(4)
# created_at :datetime
# updated_at :datetime
#

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

one:
Expand Down
19 changes: 19 additions & 0 deletions test/fixtures/bookmarks.yml
@@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: bookmarks
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# description :string(255)
# permalink :string(255)
# user_id :integer(4)
# language_id :integer(4)
# thumb_file_name :string(255)
# thumb_content_type :string(255)
# thumb_file_size :string(255)
# thumb_updated_at :datetime
# created_at :datetime
# updated_at :datetime
#

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

one:
Expand Down
17 changes: 16 additions & 1 deletion test/fixtures/comments.yml
@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: comments
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# bookmark_id :integer(4)
# language_id :integer(4)
# title :string(255)
# body :text
# importance :string(255)
# created_at :datetime
# updated_at :datetime
#

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

one:
Expand All @@ -13,4 +28,4 @@ two:
importance: high
body: This is test comment B
bookmark_id: 1
user_id: 1
user_id: 1
11 changes: 11 additions & 0 deletions test/fixtures/flags.yml
@@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: flags
#
# id :integer(4) not null, primary key
# bookmark_id :integer(4) not null
# reason :string(255) not null
# created_at :datetime
# updated_at :datetime
#

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

# one:
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/jots.yml
@@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: jots
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# language_id :integer(4)
# private :boolean(1)
# code :text
# error :text
# created_at :datetime
# updated_at :datetime
#

one:
id: 1
user_id: 1
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/languages.yml
@@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: languages
#
# id :integer(4) not null, primary key
# name :string(255)
# permalink :string(255)
# created_at :datetime
# updated_at :datetime
#

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

one:
Expand All @@ -8,4 +19,4 @@ one:
two:
id: 2
name: ruby
permalink: ruby
permalink: ruby
31 changes: 30 additions & 1 deletion test/fixtures/users.yml
@@ -1,3 +1,32 @@
# == Schema Information
#
# Table name: users
#
# id :integer(4) not null, primary key
# login :string(255) not null
# email :string(255) not null
# firstname :string(255) not null
# lastname :string(255) not null
# nickname :string(255) not null
# admin :boolean(1)
# crypted_password :string(255) not null
# password_salt :string(255) not null
# persistence_token :string(255) not null
# single_access_token :string(255) not null
# perishable_token :string(255) not null
# login_count :integer(4) default(0), not null
# failed_login_count :integer(4) default(0), not null
# last_request_at :datetime
# current_login_at :datetime
# last_login_at :datetime
# current_login_ip :string(255)
# last_login_ip :string(255)
# created_at :datetime
# updated_at :datetime
# landing_page :integer(4) default(0)
# active :boolean(1)
#

felix:
id: 1
login: felix
Expand Down Expand Up @@ -33,4 +62,4 @@ ben:
crypted_password: <%= Authlogic::CryptoProviders::BCrypt.encrypt("benrocks" + salt) %>
persistence_token: <%= Authlogic::Random.hex_token %>
single_access_token: <%= Authlogic::Random.friendly_token %>
perishable_token: <%= Authlogic::Random.friendly_token %>
perishable_token: <%= Authlogic::Random.friendly_token %>
14 changes: 14 additions & 0 deletions test/unit/bookmark_import_test.rb
@@ -1,3 +1,17 @@
# == Schema Information
#
# Table name: bookmark_imports
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# user_id :integer(4)
# description :string(255)
# language_id :integer(4)
# created_at :datetime
# updated_at :datetime
#

=begin
require 'test_helper'
Expand Down
19 changes: 19 additions & 0 deletions test/unit/bookmark_test.rb
@@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: bookmarks
#
# id :integer(4) not null, primary key
# title :string(255)
# url :string(255)
# description :string(255)
# permalink :string(255)
# user_id :integer(4)
# language_id :integer(4)
# thumb_file_name :string(255)
# thumb_content_type :string(255)
# thumb_file_size :string(255)
# thumb_updated_at :datetime
# created_at :datetime
# updated_at :datetime
#

require 'test_helper'

class BookmarkTest < ActiveSupport::TestCase
Expand Down
15 changes: 15 additions & 0 deletions test/unit/comment_test.rb
@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: comments
#
# id :integer(4) not null, primary key
# user_id :integer(4)
# bookmark_id :integer(4)
# language_id :integer(4)
# title :string(255)
# body :text
# importance :string(255)
# created_at :datetime
# updated_at :datetime
#

require 'test_helper'

class CommentTest < ActiveSupport::TestCase
Expand Down
11 changes: 11 additions & 0 deletions test/unit/flag_test.rb
@@ -1,3 +1,14 @@
# == Schema Information
#
# Table name: flags
#
# id :integer(4) not null, primary key
# bookmark_id :integer(4) not null
# reason :string(255) not null
# created_at :datetime
# updated_at :datetime
#

require 'test_helper'

class FlagTest < ActiveSupport::TestCase
Expand Down

0 comments on commit 96909b2

Please sign in to comment.