acts_as_favorite 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ begin
30
30
  gemspec.email = "kossnocorp@gmail.com"
31
31
  gemspec.homepage = "http://github.com/kossnocorp/acts_as_favorite"
32
32
  gemspec.authors = ["Josh Martin"]
33
- gemspec.version = "0.1"
33
+ gemspec.version = "0.1.1"
34
34
  end
35
35
  Jeweler::GemcutterTasks.new
36
36
  rescue LoadError
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{acts_as_favorite}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Josh Martin"]
12
+ s.date = %q{2010-03-19}
13
+ s.description = %q{This gem provides a simple way to track users favorites within the system using ActiveRecord models}
14
+ s.email = %q{kossnocorp@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README"
17
+ ]
18
+ s.files = [
19
+ "MIT-LICENSE",
20
+ "README",
21
+ "Rakefile",
22
+ "about.yml",
23
+ "acts_as_favorite.gemspec",
24
+ "generators/favorite_model/USAGE",
25
+ "generators/favorite_model/favorite_model_generator.rb",
26
+ "generators/favorite_model/templates/fixtures.yml",
27
+ "generators/favorite_model/templates/migration.rb",
28
+ "generators/favorite_model/templates/model.rb",
29
+ "generators/favorite_model/templates/unit_test.rb",
30
+ "init.rb",
31
+ "install.rb",
32
+ "lib/acts_as_favorite.rb",
33
+ "lib/identity.rb",
34
+ "tasks/acts_as_favorite_tasks.rake",
35
+ "test/acts_as_favorite_test.rb",
36
+ "test/database.yml",
37
+ "test/fixtures/books.yml",
38
+ "test/fixtures/drinks.yml",
39
+ "test/fixtures/favorites.yml",
40
+ "test/fixtures/users.yml",
41
+ "test/schema.rb",
42
+ "test/test_helper.rb"
43
+ ]
44
+ s.homepage = %q{http://github.com/kossnocorp/acts_as_favorite}
45
+ s.rdoc_options = ["--charset=UTF-8"]
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = %q{1.3.5}
48
+ s.summary = %q{User fovorites for you web application}
49
+ s.test_files = [
50
+ "test/acts_as_favorite_test.rb",
51
+ "test/schema.rb",
52
+ "test/test_helper.rb"
53
+ ]
54
+
55
+ if s.respond_to? :specification_version then
56
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
+ s.specification_version = 3
58
+
59
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
+ else
61
+ end
62
+ else
63
+ end
64
+ end
65
+
@@ -1,7 +1,6 @@
1
1
  require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
2
 
3
- class <%= class_name %>Test < Test::Unit::TestCase
4
- fixtures :<%= table_name %>
3
+ class <%= class_name %>Test < Test::Unit::TestCase
5
4
 
6
5
  # Replace this with your real tests.
7
6
  def test_truth
@@ -42,7 +42,7 @@ module ActsAsFavorite
42
42
 
43
43
  # Removes an object from the users favorites
44
44
  def has_no_favorite( favorite_obj )
45
- favorite = get_favorite ( favorite_obj )
45
+ favorite = get_favorite(favorite_obj)
46
46
 
47
47
  # ACA: The original plugin did not properly destroy the favorite.
48
48
  # Instead, it just removed the element from the favorites list. If the
data/lib/identity.rb CHANGED
@@ -1,18 +1,19 @@
1
1
  module ActsAsFavorite
2
2
  module Identity
3
-
3
+
4
4
  module UserExtensions
5
5
  module InstanceMethods
6
6
 
7
7
  def method_missing( method_sym, *args )
8
+ debugger
8
9
  if method_sym.to_s =~ Regexp.new("^favorite_(\\w+)")
9
10
  favorite_class = ($1).singularize.classify.constantize
10
11
  favorite_class.find(:all, :include => :favorites,
11
- :conditions => ['favorites.user_id = ? AND favorites.favorable_type = ?',
12
+ :conditions => ['favorites.user_id = ? AND favorites.favorable_type = ?',
12
13
  id, favorite_class.to_s ] )
13
14
  elsif method_sym.to_s =~ Regexp.new("^has_favorite_(\\w+)\\?")
14
15
  favorite_class = ($1).singularize.classify.constantize
15
- Favorite.count( :include => :user, :conditions => [ 'favorites.user_id = ? AND favorites.favorable_type = ?',
16
+ Favorite.count( :include => :user, :conditions => [ 'favorites.user_id = ? AND favorites.favorable_type = ?',
16
17
  id, favorite_class.to_s ] ) != 0
17
18
  else
18
19
  super
@@ -20,9 +21,9 @@ module ActsAsFavorite
20
21
  rescue
21
22
  super
22
23
  end
23
-
24
+
24
25
  end
25
26
  end
26
-
27
+
27
28
  end
28
- end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_favorite
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Martin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 +06:00
12
+ date: 2010-03-19 00:00:00 +06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -26,6 +26,7 @@ files:
26
26
  - README
27
27
  - Rakefile
28
28
  - about.yml
29
+ - acts_as_favorite.gemspec
29
30
  - generators/favorite_model/USAGE
30
31
  - generators/favorite_model/favorite_model_generator.rb
31
32
  - generators/favorite_model/templates/fixtures.yml