Hi,
You are welcome to comment on every aspect of this post -- not just the core
question at the bottom.
My application renders forms previously stored in the database. A Form
consists of Elements:
t.references :form,
:comment => ''What form we belong to.''
t.decimal :ordering,
:comment => ''In what order we should appear.''
t.string :name,
:null => false,
:comment => ''Name.''
t.string :title,
:comment => ''Title.''
t.string :ml_type,
:null => false,
:comment => ''Markup language type.''
t.text :value,
:null => false,
:comment => ''Value.''
t.text :flags, :comment => ''Flags.''
ml_type could be ''text'', ''select'' or any
other HTML form type.
Models:
class Element < ActiveRecord::Base
# Relationships
belongs_to :form
# Validations
validates_numericality_of :ordering
validates_presence_of :name
end
class Form < ActiveRecord::Base
has_many :elements
end
An Element should never be orphaned (i.e. without a Form). So if you want to
add an Element, you go to
http://localhost:3000/forms/1
.. which shows a Form''s name with its Elements.
At the bottom of the Forms#show page I have a link ''New
Element'' which links
to:
http://localhost:3000/elements/new?form_id=1
Problem here is that if you click Create and validation doesn''t pass,
it
forgets about the form_id parameter.
How can I make it remember the form_id?
Best regards,
CmdJohn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---