similar to: Many objects in single form

Displaying 20 results from an estimated 200000 matches similar to: "Many objects in single form"

2006 Mar 14
3
How to save parent and child objects in a single action?
Hi! I''m struggling with it for a week. I posted a few similar posts that cleared up few things (thanks Mark!), but i still don''t know how to do it properly. What i''m trying to do is to create parent object and its many children (images - i tried using file_column, but it''s a topic for another post)using data from a single form. I''ve got a working
2006 Mar 05
2
How to clean up this code?
Hi! I''ve got 2 tables: products and images. Product has_many images, image belongs_to product. In images table i store product_id and name of the image (not the image itself). I''ve created a single form, where user can add any number of images for a product he/she is creating (new fields are created using javascript). The images that are uploaded are saved to public/images
2006 Jun 19
3
Parent Child form using Partials
I am trying to make a simple application which consists of contacts and their addresses. class Contact < ActiveRecord::Base has_many :addresses end class Address < ActiveRecord::Base belongs_to :contact end I would like to be able to edit/add addresses from within the edit/add of the contact. I scaffolded the contact and address objects and modified the contacts/_form partial as
2006 Mar 08
19
Creating multiple rows with one form
Hello. I''ve been trying this out for the past two days and I can''t seem to get it. I''m going to have a page where you can upload x amount of images at once. Lets say 10 images need to be uploaded, all with a caption. I''d like to have a browse button to choose the file, then the caption. Now, if I put 10 of them in one form, fill them all out and submit, I get
2013 Jul 14
0
Form objects vs nested attributes in 1 to many association
Recently I have been reading about form objects and have been wondering its use in 1 to many assocation. Let''s say I have a model of project with many tasks and the user edits the project along with the tasks in one big form. Is nested attributes using cocoon gem better suited than using reform/virtus or other form objects? Any examples of using form objects in this context? --
2006 Mar 08
3
Many renders in one view?
Hi! This was probably asked many times, but i can''t find it anywhere. How to render in my view many actions (sometimes from different controllers)? So i.e. I will have user status/login form at the top, form for creating/editing some data on the left and a list of these data elements on the right and some other things at the bottom? Can i put some of this stuff to the layout? So i
2006 May 31
1
Creating Multiple Child objects on a single form
I''ve been trying to solve this for the last few hours and I have something that is working now but I''m curious if there isn''t a better ''right'' way to do it since this seems a bit of a cludge to me, but I haven''t find a better way to make it work. The models are as follows: Goals, which have multiple objectives. Goals also have multiple
2008 Nov 19
0
has_many through select box in form
Gentlemen, I have searched the group and have not found any post that clarifies thsi s=issue to me. Please forgive me in advance if I missed something. I have 3 models: Ticket has_many :citations, :dependent => :nullify has_many :violations, :through => :citations Violation has_many :citations, :dependent => :nullify has_many :tickets, :through => :citations Citation
2006 Jan 28
0
Auto drop list: Create a form professional or easy?
Hi all, I''m searching for a method to dynamically build a form. ( false/true field in the DB should automatically be a droplist) If you use "_form.rhtml" it works easy, with only this code in your partial, but uses the extra file, and doesn''t feel profi and flexible. <%= start_form_tag :action => ''create_product'' %> <%= render
2009 Jun 19
0
[PATCH server] add toggable sections to vm form
the vm form is getting cluttered, this patch simply add collapsable sections to the form, making the 'resources' and 'network' sections collapsed by default - icon added - methods added to the js - reorganization / cleanup in rhtml, indentation changes, no functionality or content changes --- src/app/views/vm/_form.rhtml | 109
2007 Apr 13
1
How can I use aggregation objects in form_for?
Say I have a person object which has a aggregation object call address. The the code to manipulate a form for create a new person should be: # new.rhtml <% form_for :person, :url => {:action => ''create''} do |f| %> <%= render :partial => ''form'', :locals => {:f => form} %> <%= submit_tag "Create" %> <% end %>
2006 Apr 05
3
CRUD pattern for has_many relationships (forms containing collections)?
Hello folks! Beare with me for a second, while I explain my problem. Assuming we have the trivial model of class Author has_many :books end class Book end How do people go about creating the authors/edit and authors/new views if you want to be able to add and remove arbitrary amount of Books at Author creation and edit time? What I mean by this is that I go to
2006 Mar 13
6
Specifying none/single/many conditions at the same time
Hi! It''s rather ruby question than rails... I have a single ''list'' action where i call paginate method. I can receive none, 1 or 2 variables that specify conditions for paginate method. How to write the code so i can call paginate without conditions if all conditions variable are nil, with a single condition if one of conditions variables is not empty and with 2 if
2006 Mar 05
4
Resizing images and creating thumbnails
Hi, 1. How to resize an image uploaded by a web form before saving it to the disk? (i need all uploaded images to have similar size) 2. How to create thumbnails? Is it enough if i specify small size of the image in html or would the image look horrible? Can i do it somehow in ''realtime'' using javascript? Or is it best to create thumbnail as a separate file? 3. How to get
2006 Sep 25
0
Newbie: Proper way to set default text_field form value ?
I''m using the _form.rhtml partial for both the new.rhtml and edit.rhtml views like this: <% if @product.cost %> <%= text_field ''product'', ''cost'', :size => 5 %> <% else %> <%= text_field ''product'', ''cost'', :size => 5, :value => 0 %> <% end %> I couldn''t find a
2006 Feb 04
1
Error when using form helper and child objects
Hi, This is one problem that has gotten me stumped for quite a while. I have an Item that has_many :DeliveryMethod, and what I seek to achieve is to create a form that''d let me create an Item, as well as its DeliveryMethods in 1 single form. And so I tried something like: <%= text_field_tag ''Item[DeliveryMethod][price]'', @Item.DeliveryMethod ?
2006 Mar 04
5
has_many and belongs_to example?
Hi! If i have 2 tables i.e. product and images and product has_many images, image belongs_to product - how to create _form.rhtml, new/create and edit/update methods in product controller, so in a single form i can add one product and MANY (let''s assume for now that this number is fixed) images for this product? Pleeeeease help me :) -- Posted via http://www.ruby-forum.com/.
2006 Jan 18
22
Creating multiple child objects from the same form
I''ve been digging into rails, but this one question has been a two day stumper. I''ve got a question/answer model that I''m trying to work out. Each question has multiple answers (they''re more like choices, it doesn''t matter whether they''re right or wrong), and I''d like to have the question creation form also have multiple fields in
2006 Jul 06
1
Form not inserting data into database
I have a form to register a user. The issue I am having is the fact that it only populates login, hashed_password and created_at fields. DB table: create table users ( id int not null auto_increment, login varchar(100) default null, hashed_password char(40) default null, email varchar(255) default null, salt varchar(255) default
2006 May 24
0
Problems validating form with collection_select
I have the following models: class Comandancia < ActiveRecord::Base has_many :elementos end class Elemento < ActiveRecord::Base belongs_to :comandancia validates_presence_of :nombre, :apellido_paterno, :apellido_materno, :comandancia end In the view for New Elemento I''m using <%= start_form_tag :action => ''create'' %> <%= render :partial =>