I'm trying to create a plugin that has a field that is validated. Using
standard ruby syntax I can make sure that invalid values aren't
accepted. However valid values don't get written out to the YAML file.

Here's what I have so far. Any ideas what I'm doing wrong? I'm pretty
new to ruby and ditz, so I wouldn't be surprised if I'm missing
something basic.

def self.get_allowed_priorities 
  return ["P1", "P2", "P3", "P4", "P5"] 
end

field :priority, :multi => false, :default => "P3", :prompt => "Specify
a priority (#{Issue.get_allowed_priorities * ","})"

def priority=(priority) 
  if !Issue.get_allowed_priorities.include? priority 
    raise Error, "Priority #{priority} is not in the list of allowed
priorities (#{Issue.get_allowed_priorities * ","})" 
  end 
  @priority = priority 
end

_______________________________________________
ditz-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ditz-talk

Reply via email to