Change ModuleAppTag into "Module name"Tag.

This commit is contained in:
Christophe Vilayphiou 2012-02-15 15:18:11 +08:00
parent d0c2856a3a
commit af3a2547e1
3 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,12 @@ class Admin::TagsController < ApplicationController
end end
def create def create
@tag = (params[:tag][:module_app_id].blank? ? Tag.create(params[:tag]) : ModuleAppTag.create(params[:tag])) if params[:tag][:module_app_id].blank?
@tag = Tag.create(params[:tag])
else
module_app = ModuleApp.find(params[:tag][:module_app_id])
@tag = eval("#{module_app.key.capitalize}Tag").create(params[:tag])
end
end end
def update def update

View File

@ -1,4 +1,4 @@
class ModuleAppTag < Tag class AnnouncementTag < Tag
has_and_belongs_to_many :bulletins has_and_belongs_to_many :bulletins

View File

@ -8,7 +8,7 @@ class Bulletin
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :tags, :class_name => "ModuleAppTag" has_and_belongs_to_many :tags, :class_name => "AnnouncementTag"
field :postdate , :type => Date field :postdate , :type => Date
field :deadline , :type => Date field :deadline , :type => Date