forked from Restream/redmine_tagging
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build on the redmine search infrastructure
- Loading branch information
friflaj
committed
Sep 24, 2010
1 parent
b9628b8
commit 3fc85f3
Showing
8 changed files
with
111 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class IssueTag < ActiveRecord::Base | ||
belongs_to :issue | ||
|
||
def readonly? | ||
return true | ||
end | ||
|
||
# Prevent objects from being destroyed | ||
def before_destroy | ||
raise ActiveRecord::ReadOnlyRecord | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class WikiPageTag < ActiveRecord::Base | ||
belongs_to :wiki_page | ||
|
||
def readonly? | ||
return true | ||
end | ||
|
||
# Prevent objects from being destroyed | ||
def before_destroy | ||
raise ActiveRecord::ReadOnlyRecord | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'rails_sql_views' | ||
|
||
class CreateViews < ActiveRecord::Migration | ||
def self.up | ||
create_view :issue_tags, "select taggings.id, tags.name as tag, taggings.taggable_id as issue_id from taggings join tags on taggings.tag_id = tags.id where taggable_type = 'Issue'" | ||
create_view :wiki_page_tags, "select taggings.id, tags.name as tag, taggings.taggable_id as wiki_page_id from taggings join tags on taggings.tag_id = tags.id where taggable_type = 'WikiPage'" | ||
end | ||
|
||
def self.down | ||
drop_view :issue_tags | ||
drop_view :wiki_page_tags | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,50 @@ | ||
require_dependency 'issue' | ||
|
||
module WikiPagePatch | ||
def self.included(base) # :nodoc: | ||
base.extend(ClassMethods) | ||
base.send(:include, InstanceMethods) | ||
|
||
base.class_eval do | ||
unloadable | ||
|
||
acts_as_taggable | ||
require_dependency 'wiki_page' | ||
|
||
module Tagging | ||
module WikiPagePatch | ||
def self.included(base) # :nodoc: | ||
base.extend(ClassMethods) | ||
base.send(:include, InstanceMethods) | ||
|
||
base.class_eval do | ||
unloadable | ||
|
||
acts_as_taggable | ||
|
||
has_many :wiki_page_tags | ||
end | ||
end | ||
|
||
module ClassMethods | ||
end | ||
|
||
module InstanceMethods | ||
end | ||
end | ||
|
||
module ClassMethods | ||
end | ||
|
||
module InstanceMethods | ||
end | ||
end | ||
|
||
module IssuePatch | ||
def self.included(base) # :nodoc: | ||
base.extend(ClassMethods) | ||
base.send(:include, InstanceMethods) | ||
|
||
base.class_eval do | ||
unloadable | ||
|
||
acts_as_taggable | ||
|
||
module IssuePatch | ||
def self.included(base) # :nodoc: | ||
base.extend(ClassMethods) | ||
base.send(:include, InstanceMethods) | ||
|
||
base.class_eval do | ||
unloadable | ||
|
||
acts_as_taggable | ||
|
||
has_many :issue_tags | ||
end | ||
end | ||
|
||
module ClassMethods | ||
end | ||
|
||
module InstanceMethods | ||
end | ||
end | ||
end | ||
|
||
module ClassMethods | ||
end | ||
Issue.send(:include, Tagging::IssuePatch) unless Issue.included_modules.include? Tagging::IssuePatch | ||
|
||
module InstanceMethods | ||
end | ||
end | ||
WikiPage.send(:include, Tagging::WikiPagePatch) unless WikiPage.included_modules.include? Tagging::WikiPagePatch |