public
Description: flag content as inappropriate
Clone URL: git://github.com/courtenay/can_flag.git
start hacking in generators, cargo cult from restful_auth
courtenay (author)
Sun Mar 16 20:07:24 -0700 2008
commit  8170a91288a4abe9398c7433ed3370359cc52f92
tree    f90645a243ab51d847c88e26df48b4509115f04a
parent  0f7ffe304a374701e938dd5e86c92a40ed67c6ba
...
15
16
17
18
 
19
20
21
...
15
16
17
 
18
19
20
21
0
@@ -15,7 +15,7 @@ end
0
 desc 'Generate documentation for the can_flag plugin.'
0
 Rake::RDocTask.new(:rdoc) do |rdoc|
0
   rdoc.rdoc_dir = 'rdoc'
0
- rdoc.title = 'ActsAsAttachment'
0
+ rdoc.title = 'CanFlag'
0
   rdoc.options << '--line-numbers --inline-source'
0
   rdoc.rdoc_files.include('README')
0
   rdoc.rdoc_files.include('lib/**/*.rb')
...
2
3
4
 
 
5
6
7
8
 
 
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
35
...
2
3
4
5
6
7
8
 
9
10
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0
@@ -2,33 +2,37 @@ class Flag < ActiveRecord::Base
0
   # serialize :flag, Symbol
0
   belongs_to :flaggable, :polymorphic => true
0
   
0
+ # This is set dynamically in the plugin.
0
+ # define "can_flag" in your user/account model.
0
   # belongs_to :user
0
 
0
- # A user can flag a specific flaggable with a specific flag once
0
   validates_presence_of :flag
0
+
0
+ # A user can flag a specific flaggable with a specific flag once
0
   validates_uniqueness_of :user_id, :scope => [:flaggable_id, :flaggable_type, :flag]
0
   
0
- # Helper class method to lookup all flags assigned
0
- # to all flaggable types for a given user.
0
- def self.find_flags_by_user(user)
0
- find(:all,
0
- :conditions => ["user_id = ?", user.id],
0
- :order => "created_at DESC"
0
- )
0
- end
0
-
0
- # Helper class method to look up all flags for
0
- # flaggable class name and flaggable id.
0
- def self.find_flags_for_flaggable(flaggable_str, flaggable_id)
0
- find(:all,
0
- :conditions => ["flaggable_type = ? and flaggable_id = ?", flaggable_str, flaggable_id],
0
- :order => "created_at DESC"
0
- )
0
- end
0
-
0
- # Helper class method to look up a flaggable object
0
- # given the flaggable class name and id
0
- def self.find_flaggable(flaggable_str, flaggable_id)
0
- flaggable_str.constantize.find(flaggable_id)
0
- end
0
+ # UNTESTED
0
+ # # Helper class method to lookup all flags assigned
0
+ # # to all flaggable types for a given user.
0
+ # def self.find_flags_by_user(user)
0
+ # find(:all,
0
+ # :conditions => ["user_id = ?", user.id],
0
+ # :order => "created_at DESC"
0
+ # )
0
+ # end
0
+ #
0
+ # # Helper class method to look up all flags for
0
+ # # flaggable class name and flaggable id.
0
+ # def self.find_flags_for_flaggable(flaggable_str, flaggable_id)
0
+ # find(:all,
0
+ # :conditions => ["flaggable_type = ? and flaggable_id = ?", flaggable_str, flaggable_id],
0
+ # :order => "created_at DESC"
0
+ # )
0
+ # end
0
+ #
0
+ # # Helper class method to look up a flaggable object
0
+ # # given the flaggable class name and id
0
+ # def self.find_flaggable(flaggable_str, flaggable_id)
0
+ # flaggable_str.constantize.find(flaggable_id)
0
+ # end
0
 end
0
\ No newline at end of file
...
1
2
3
 
4
5
6
 
7
8
9
10
11
 
12
13
14
15
16
17
18
19
 
20
...
1
2
 
3
4
5
 
6
7
8
9
10
 
11
12
13
14
15
16
17
 
18
19
20
0
@@ -1,18 +1,18 @@
0
 sqlite:
0
   :adapter: sqlite
0
- :dbfile: attachment_fu_plugin.sqlite.db
0
+ :dbfile: can_flag_plugin.sqlite.db
0
 sqlite3:
0
   :adapter: sqlite3
0
- :dbfile: attachment_fu_plugin.sqlite3.db
0
+ :dbfile: can_flag_plugin.sqlite3.db
0
 postgresql:
0
   :adapter: postgresql
0
   :username: postgres
0
   :password: postgres
0
- :database: attachment_fu_plugin_test
0
+ :database: can_flag_plugin_test
0
   :min_messages: ERROR
0
 mysql:
0
   :adapter: mysql
0
   :host: localhost
0
   :username: rails
0
   :password:
0
- :database: attachment_fu_plugin_test
0
\ No newline at end of file
0
+ :database: can_flag_plugin_test
0
\ No newline at end of file

Comments

    No one has commented yet.