similar to: Am I wrong or is fields_for not working right in Rails 2.2.2

Displaying 20 results from an estimated 500 matches similar to: "Am I wrong or is fields_for not working right in Rails 2.2.2"

2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models: class Order < ActiveRecord::Base belongs_to :billing_address belongs_to :shipping_address accepts_nested_attributes_for :billing_address accepts_nested_attributes_for :shipping_address, :reject_if => proc { |attributes| attributes[''has_shipping_address''] != ''1'' } def after_initialize self.build_billing_address
2006 Mar 13
4
Trouble Using AR Object based on a Piggyback Query?
Hi, I''m new to Rails and Ruby and can''t access methods/columns from an ActiveRecord object that is a "piggy-back" row as described by David here: http://www.loudthinking.com/arc/000235.html Via Console I can create the piggyback object but reading attributes gives "TypeError: cannot convert String into Integer" (this is in Console and the browser).
2007 Nov 20
2
confirming that a model instance was correctly created from POST params
I''m wondering whether I''m wasting my time trying to verify that an addition I''ve made to legacy code is in fact setting a new attribute on a model. Substruct''s (http://dev.subimage.com/projects/substruct) OrderHelper contains this method: 1 def create_order_from_post 2 @use_separate_shipping_address = params[:use_separate_shipping_address]
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 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
1
fields_for weirdness
I just did a large upgrade to to Rails 2.3.4 and I am trying to make use of the more modern view features. I have a Newsletter object. Newsletter has many Sections. I also have: accepts_nested_attributes_for :sections on the Newsletter object. I have the typical scaffolded new.html.erb with: <% form_for(@newsletter) do |f| %> in there, I am trying to populate the first Section
2008 May 02
1
names of select elements inside a fields_for block not generated as expected
Hey All, I''m trying to play along w/the ''complex forms 1'' railscast (http://railscasts.com/episodes/73) and having trouble. The view is projects/new. I''m trying to add some project_people to the form w/code like so: <% form_for(@project) do |f| %> [project stuff here] <% for pp in @project.project_person %> <% fields_for
2011 Apr 04
1
Best way to instanciate an empty address element in many nested fields_for
Hi! I have 3 models, User, Company and Address. Basically, a User belongs to a Company and an Address has one Company (because it can be linked to other models). In a form I want to display a User, its Company and its company Address, with fields_for. The problem is when my User has a Company, that does *not* have an Address: the part containing the Address is not displayed. I see 2 ways of
2013 Dec 10
2
form_tag + fields_for Rails 4
Hi There, I''m trying to user fields_for inside a form_tag, but i can''t catch it on my controller. I just take some html code off to makes it easy to read my view... i''m using campuses_path(current_church, @campus) instead form_for @campus, because my route is like resources :campuses, :path => ":church/campuses" <%= form_tag
2012 Jan 20
3
Fields_for adding html (text) for hidden field
Hello all, I''m getting this weird ''<input name value=''2'' type=''hidden'' />'' text printed out in my form. See attached image. I''ve spent too much time trying to figure it out already and it''s not going to stop me from moving on for now. As you can see it''s still very early on. I''m using
2006 May 16
1
fields_for giving undefined method exception
I''m getting an undefined method exception with the fields_for method. I''m following the gem examples. The form_for works but when I add fields_for it breaks. Are there other examples of how this works anywhere? -- Posted via http://www.ruby-forum.com/.
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
I''m trying to figure out the Rails way to model the following problem: I have 2 tables. One (let''s call it location) contains a single address. The other (let''s call it company) contains 3 address. I''m trying to figure out the best way to model this. I''ve created an address table, a set up the model as follows: class Address <
2008 Mar 11
1
fields_for in a form_for_remote?
Can you nest fields_for in a form_for_remote? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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
2009 Feb 09
2
how to get form parameters while using fields_for with nested attributes
hi all.. i am trying to use *fields_for* to get and save nested attributes in a form. i have a ''Partner'' model associated with an ''Address'' model. partner has_many :addresses although the form is displaying fine, but on submitting it the following error is shown: *can''t convert HashWithIndifferentAccess into Array* on this line: *@partner =
2010 Nov 28
6
has_one accepts_nested_attributes_for fields_for NOT WORKING HELP
MODEL class User < ActiveRecord::Base has_one :address, :dependent => :destroy accepts_nested_attributes_for :address end CONTROL def new @user = User.new @user.build_address # Adicionei ... VIEW partial _form .... <% f.fields_for :address do |b| %> # Adicionei <%= b.text_field :city_manual %> # Adicionei <% end %>
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up examples of how to have multiple entities in a single-table inheritance related to anything. I have an addresses table, but multiple entities can have Addresses: both Person (which has 2 addresses) and Retailer. I''ve been told that I need to use single-table inheritance, and this was my attempt:
2006 Jun 01
4
how can I control when to commit a transaction?
hello it seems like this question has appeared a few times with no answer: how do you get rails to issue ''write'' statements (ie ''CREATE/UPDATE'') to the database without committing each time? I tried setting ActiveRecord::Base.connection.begin_db_transaction before calling any action on my object, but as soon as myObject.save or myObject.update is called,
2009 Feb 18
5
fields_for and Conflicting types for parameter containers. Expected an instance of Hash but found an instance of Array.
I''m trying to use ''fields_for'' in a form. I want the same form to support both the creation of new obejcts as well as the editing of old ones. So - in my controller, sometimes I will pass to the form an object that already exists in my database and has an id and other times I will pass it a newly created instance of an object that does not yet exist in the database and
2008 Jul 07
0
ActiveRecord in Rails 2.1.0 misbehaving for Aggregate Attr.
I am not sure if this is a bug in ActiveRecord or is this the intended behavior. If it is then it does not make sense to me. In a nutshell: If you change an aggregate object attribute created via composed_of method (see Agile Web Development - Second Edition Chapter 17 page 313 onwards) and then save the model, the change to the model (composite attribute specifically) will not be saved UNLESS
2008 Dec 21
1
Form issues : partials + AJAX vs simple JS / separate views + form_fors vs one view and fields_fors
Hi all! I am coding an application that keeps track of request to create college courses. An identified user (logically a faculty member) completes a form indicating the name of the course, the professor in charge, the course''s code, the date and place, the possible coprofessors and TAs and the type of website he or she wants to use as a teaching help (WebCT, Sakai, etc.). I have two