similar to: 'double' nest form fields with accepts_nested_attributes_for

Displaying 20 results from an estimated 2000 matches similar to: "'double' nest form fields with accepts_nested_attributes_for"

2012 Aug 25
0
accepts_nested_attributes_for and fields_for not working!
I want to be able to create one menu object that has fields_for :brunch, :lunch, and :dinner. The menu object has_many brunches, lunches, and dinners, but each time I "edit", only one brunch, one lunch, and one dinner object are added. I''m using carrierwave to upload brunch_menus, lunch_menus, and dinner_menus (attributes of brunches, lunches, and dinners respectively) as
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
2010 Feb 06
1
accepts_nested_attributes_for with has_many => :through
I have two models, links and tags, associated through a 3rd model, link_tags. I added the following to my link model, has_many :tags, :through => :link_tags has_many :link_tags accepts_nested_attributes_for :tags, :allow_destroy => :false, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } and put this in a partial called by the new and edit forms for links,
2011 Jul 16
0
nested_form gem don't work for accepts_nested_attributes_for :limit
Hello, I have the next: class Post < ActiveRecord::Base has_many :image, :dependent => :destroy accepts_nested_attributes_for :image, :allow_destroy => true, :limit => 4 end class Image < ActiveRecord::Base belongs_to :Post ... paperclip settings ... end And the form view for the post is: <%= nested_form_for @post, :html => { :multipart => true } do |f| %>
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 %>
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
2010 Dec 07
1
fields_for and one out of many from association
class Person < ActiveRecord::Base has_many :addresses has_one :primary_address, :class_name => ''Address'', :order => ''preferred desc, id'' accepts_nested_attributes_for :addresses, :allow_destroy => true accepts_nested_attributes_for :primary_address, :allow_destroy => true end class Address < ActiveRecord::Base belongs_to :person end
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
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
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
2010 Jan 26
2
accepts_nested_attributes_for :has_many :through => 'bug?'
Hey guys & ladies! I''ve got the following relationship which i''m trying to get accepts_nested_attributes to work with. But when i submit my form, it looks as if its expecting a Company object, rather than an array of companies. which really doesn''t make sense considering its a has_many :relationship. So what i''m after, is a way to
2013 Nov 10
3
accepts_nested_attributes_for how, example
I have following tables with following models: users(id, role_id) *has_many :entries* categories(id, category_name) *has_many :entries* entries(id, category_id, user_id) *belongs_to :user, belongs_to :category, has_one :storage* storages(id, title, content, entry_id)* belongs_to :entry*, *has_one :vote* votes(id, count, storage_id) *belongs_to :storage* Now,
2010 Jun 24
0
Nested Model Forms
I''m trying to get a multi level nested form model working but have hit a problem. In one of my models, I have a habtm association and it''s throwing an error on a nested form and these are check boxes with a method of ''time_unit_ids[]''. The nested forms work without the habtm (time_unit_ids[]) so things are pretty much set up okay. Here''s the set up
2013 Mar 14
0
[Rails 3.2] accepts_nested_attributes_for and time_select
Hi, I am upgrading a Rails application from Rails 3.1.11 to 3.2.12, but have a problem with ` accepts_nested_attributes_for` in conjunction with multipart attributes. The app is used to manage oral exams, so there is a model `Exam`, which has many `Examdate`s. When creating an exam, I can also create the examdates, consisting of a date, a start time and an end time. While the date field is
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
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
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the console, but not from the view. I have the following: # partial schema create_table "users", :force => true do |t| t.string "login", :null => false t.string "first_name" t.string "last_name" t.string "email", :null => false
2010 Oct 15
1
Help with nested form: User and Artist
Artist is 1:1 with User. User has_one :artist In my artist model, I have: belongs_to :user accepts_nested_attributes_for :user However, in my artist _form, the name column from the user model does not display. I am doing: <% f.fields_for :user do |builder| %> <p class="fields"> <%= builder.label :name %> <%= builder.text_field :name %>
2011 Aug 22
0
Paperclip nested resources problem
My models: class Country < ActiveRecord::Base has_many :regions has_many :assets, :dependent => :destroy accepts_nested_attributes_for :assets end class Region < ActiveRecord::Base belongs_to :country has_many :appartments has_many :assets, :dependent => :destroy accepts_nested_attributes_for :assets end class Asset < ActiveRecord::Base belongs_to :region
2009 Jul 01
2
Nested Forms - how to displayed the attributes content ?
I have a User model class User < ActiveRecord::Base has_one :account accepts_nested_attributes_for :account, :allow_destroy => true validates_associated :account attr_accessible :account_attributes is working fine, validating and updating both records (User and Account), but I caanot display the value in the form when is updated, ex: below the firstname is not displayed but