I have a table, 'statuses' as follows: id as int statusname as varchar autoadvanceto as int
The 'autoadvanceto' column references an id in the statuses table itself. (I have not specified any association in the Status model -- would I do both a belongs_to as well as a has many, with foreign_key => 'autoadvanceto' ?) My real question here, is in the module StatusHelper. I am setting up a select in form view of the autoadvanceto field so as to show the various statusnames to select from. This it does fine -except- it does not prepopulate the select box by setting the autoadvanceto that is already in the database for the given row, nor does it update the database if I change what is in the select box. I've followed to docs very closely here I believe, specifically: http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html Below is my attempt in my module StatusHelper to accomplish this. can anyone please tell me why my populated select box is not saving the selection on update, and why it is not selecting what the autoadvanceto value is if not 0 to begin with? Thank you, -Janna B. def autoadvanceto_form_column(record, input_name) select("status", "autoadvanceto", getstatuses.collect {|p| [ p.statusname, p.id ] }, {:prompt => 'Select:'})#, :include_blank => true}) end private def getstatuses statuses = Status.find(:all, :conditions => ["deleted=? ", 0], :order => 'statusname') end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
