Articles can be tagged. The tags table contains a name and value.
Each article can only have one tag with a given name. In the article
update page, I want to be able to select a name for a tag from a
dropdown, then a value for the tag from a dependent dropdown. (For
example, the "importance" tag might have values "who cares?", "walk
away", and "run for the hills!". The "credibility" tag might have
values "tin foil", "omg", "TRVTH".)
What I'm getting is two empty dropdowns. I have defined name_column
and value_column in ArticleTagsHelper, but they are not being called.
Help?
class Article < AR::B
...
has_many :article_tags
...
end
class ArticleController < AC
...
config.columns = [ ... :article_tags]
...
end
class Tag < AR:B
validates_presence_of :name
validates_presence_of :value
validates_uniqueness_of :value, :scope => :name
has_many :tag_values, :dependent => :destroy
end
class ArticleTag < AR::B
...
validates_presence_of :article_id
validates_presence_of :tag_id
belongs_to :article
belongs_to :tag
validates_uniqueness_of :article_id, :scope => name
def name
tag ? tag.name : nil
end
def value
tag ? tag.value : nil
end
end
class ArticleTagsController < AC
...
config.columns = [:article, :name, :value]
config.subform.columns.exclude :article
config.columns[:name].form_ui = :select
config.columns[:name].required = true
config.columns[:value].form_ui = :select
config.columns[:name].required = true
...
end
Pointers?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---