Permalink
Browse files

Most of Tags working I think. Spotted nilClass error when no Favorite…

… view page.
  • Loading branch information...
robertmilner committed Mar 17, 2012
1 parent 1645e20 commit cdfc20602c6ba734c6b1c0b4f1b238870244504e
View
@@ -0,0 +1,7 @@
+class Tag < ActiveRecord::Base
+
+ # associations
+ has_many :taggings, :dependent => :destroy
+ has_many :excuses, :through => :taggings
+
+end
View
@@ -0,0 +1,7 @@
+class Tagging < ActiveRecord::Base
+
+ # associations
+ belongs_to :excuse
+ belongs_to :tag
+
+end
@@ -0,0 +1,9 @@
+class CreateTags < ActiveRecord::Migration
+ def change
+ create_table :tags do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
@@ -0,0 +1,10 @@
+class CreateTaggings < ActiveRecord::Migration
+ def change
+ create_table :taggings do |t|
+ t.integer :tag_id
+ t.integer :excuse_id
+
+ t.timestamps
+ end
+ end
+end
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ tag_id: 1
+ excuse_id: 1
+
+two:
+ tag_id: 1
+ excuse_id: 1
View
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+
+two:
+ name: MyString
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TagTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class TaggingTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end

0 comments on commit cdfc206

Please sign in to comment.