similar to: editing multiple models in one form

Displaying 20 results from an estimated 12000 matches similar to: "editing multiple models in one form"

2007 Sep 04
3
Finding the position on an item in a collection
This feels like it should be easy but i can''t work it out: if i have a collection of stories, ordered by (for example) date, then how do i find out the position of the story with id = (eg) 23 in the collection? I guess this is a ruby question rather than a rails-specific question, but maybe there''s a rails way... -- Posted via http://www.ruby-forum.com/.
2007 Oct 17
2
Complex Forms (From Railscasts.com)
Hi, I have been watching the last three episodes on railscasts.com in which he goes through dealing with multiple models in one for using fields_for, and virtual attributes. (http://railscasts.com/episodes/ 73). Here is an example of the way they suggest to go about it: # projects_controller.rb def new @project = Project.new 3.times { @project.tasks.build } end def create @project =
2007 May 17
1
exec format error
Hi I have been using backgroundrb version 0.1 for a while. Unfortunately, I have to develop on windows :( It has worked fine for a while. However, this morning I started up and old app that worked fine and get this error. exec format error from running --trace I see that the error comes from backgroundrb_tasks.rb line 59 which reads: 59 `#{scripts_src}/start -d` Here is the context. desc
2007 Feb 14
1
cron like behaviour?
Hi I have previously used railscron for server-side manipulation of the database but had a heap of trouble working with it. BackgrounDRB was suggested to me by a friend. I upload some files via acts_as_attachment and these go lie in a dir structure that i desire. What I want from the background process is to periodically (not user initiated) do some file-structure manipulation i.e. I want to
2008 Feb 07
11
Multiple Views within subfolders
Hi, I am creating an application in which I am allowing users to have customized views of a form. These forms do not have to be customized at this point by the user, but will for now be customized by us, and uploaded to the server. My idea was to take the similar approach done by the plug in acts_as_attachment, and, have a default layout stored in the normal views/controller_name folder, but
2006 Feb 28
6
Problem with select and each_with_index
Disclaimer: Ruby newbie at work Thought I was going so well. Wanted to produce a select box from an array constant, with the indices returned as values , and the array values used as the descriptions. Checked out Ruby RDoc and saw there was an each_with_index method and came up with: <%= select (''type'', ''typecategory'', Typecategory.each_with_index
2008 Jan 21
1
shared sessions and rails2
Hi all How would you go about sharing a session between two rails2 applications? I am using restful_authentication. A point in the direction of some relevant blogs would also be a great help. Regards Ivor --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to do, but for some reason I thought using it scoped an object around an association. For example, I have a User class and when you''re creating a new user I want to use fields_for to add a BillingAddress to the user like so: <%- fields_for :billing_address do |billing_address_form| -%> <%= render :partial
2008 Dec 02
4
Sharing a partial between multiple controllers
I want to share a partial between 2 or more controllers. I have a "location" partial that I want users to enter "Address, City, State, Zip" information in however I have "Payees", "Institution", and "Event" models that can have "location" information stored with them. Since I don''t want to duplicate the partial across each
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
I''m trying to build something similar to a Facebook messaging app, in which the view displays all the messages for a particular thread, with a form box for replying at the bottom of the thread. The problem is that using fields_for generates form fields for each existing record, and for one new record. In this case, there is no need to edit existing messages - just a need to add new
2007 Sep 24
3
Oracle Date + RoR
Hi Experts, I''ve a model called Product where i''ve column called created_at, updated_at where i''ve made a query based on Oracle date format like date_of_created = ''23-SEP-07'' @product = Product.find(:all, :conditions => ["created_at=?", date_of_created]) but in view its empty. AND EXPERTS I''VE DATA WITH 24-SEP-07 FOR MORE
2007 Sep 10
2
form_remote_tag not providing params in Ajax
I''m new to Ruby, Rails and Ajax and I''m trying to do something seemingly simple. I am trying to use a value someone supplies in a form in another form that is dynamically generated using Ajax. I have the following code: <div id="race_table"> &nbsp; </div> <%= form_remote_tag(:update => "race_table", :url => { :action =>
2011 Jul 25
4
[Rails 3.0.9] I have trouble about fields_for
Hi,all. I''m new bee to Rails and I have trouble about fields_for method.. It isn''t show up between the <%= f.fields ~ <% end %> Please teach me some advice. Thanks! #new/_form.html.erb <%= form_for(@user) do |f| %> <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> <!-- Below
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for The System model has_many children. If I do this in my haml template: -form_for @system do |s| =s.text_field :name -s.fields_for :children do |child_fields| =child_fields.text_field :name all is fine. The fields_for iterates over all children and puts the correct data in the fields. But...what I
2011 Jul 11
2
Pre-populating association
Hello, I think this is an easy one for the average Rails developer but I''m a bit stuck. I''m creating a simple voting app: any user can create a survey, with any number of questions, and other users can then vote by creating a ballot for that survey. Here''s the modeling: class Survey < ActiveRecord::Base has_many :questions has_many :eligibilities has_many
2006 Apr 03
2
Fast way of finding new position for model object?
I have a model object that acts as a list. The position of each object is determined by two factors: number of votes ascending and age of object descending. When a user adds or deletes a vote I need to quickly update the associated model object''s position. Right now this is done with the following method: def update_position position = nil Bug.find(:all, :order =>
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all, After many days of struggling, I have a multi-model form with ajax elements more or less working, but I''m hitting a wall with a few bugs that I can''t figure out. Guidance would be very much appreciated. I''m using the Ryan Bates technique from Advanced Rails recipes to dynamically add and remove elements on a multi-model form.
2006 May 12
1
each_with_index. Can you start at a desired index position?
When using array.each_with_index how do you start at a desired index position? I can do it like this, but its not very clean and doesnt seem efficient : desired_index_start = 20 array.each_with_index do |value,index| next if index<desired_index_start end Thanks Chris -- Posted via http://www.ruby-forum.com/.
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
When submitting billing information in the past I''ve always used attr_accessor for credit card details as they should not be saved in the database. In addition I always end up storing the card expiration date so that the date form helper works correctly. With Active Model it seems logical to create a CreditCard class to hold this data instead. **1st issue.** It seems there still
2006 Dec 17
1
file_column error: StringIO Instead of Temp_File
Hi all, i am using file_column to upload 3 images from the same form, they are all different names and DOM IDs so there isn''t a problem with the multiple upload. The problem is when i try to upload a file (or 2, or 3) sometimes it works, but sometimes i get this in the log file: "bar_image"=>{"file_temp"=>"",