similar to: Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)

Displaying 20 results from an estimated 3000 matches similar to: "Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)"

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
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 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 %>
2010 Feb 25
1
accepts_nested_attributes_for vs. multiple controllers on one page
Hi, I''d like to render the results from show, create, edit and delete actions for several different models (one controller per model) on one page. While these several models are conceptually related, they do not need to be associated with each other. So, I''d rather not impose associations on them just to use accepts_nested_attributes_for to facilitate their presentation in a
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,
2013 Apr 15
4
Rails' scaffold controller generator - should it test json format also?
(Forgive me if this is incorrect, because I recognized this initially as something in Rails 4.0.0.beta1 and have just done a cursory look over the latest generator code.) Noticed in Rails 4 that the test generated for a scaffold controller only tests the html format instead of both html and json:
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 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| %>
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
2011 Sep 27
0
accepts_nested_attributes_for is not working for uniqueness
class User < ActiveRecord::Base accepts_nested_attributes_for :emails, :allow_destroy => true, :reject_if => proc { |attributes| attributes[''address''].blank? } end class Email < ActiveRecord::Base belongs_to :user validates_presence_of :address validates_email_format_of :address validates_uniqueness_of :address,
2009 Jul 28
0
'double' nest form fields with accepts_nested_attributes_for
Hi Is it possible to ''double'' nest form fields with accepts_nested_attributes_for? Something like: [code=ruby]<% form_for parent do |parent_form| %> <% parent_form.fields_for parent_children do |parent_children_fields| %> ... <% parent_children_fields.fields_for parent_child_activities do | parent_child_activities_fields| %>
2010 Mar 09
0
undefined method `accepts_nested_attributes_for' for #<Class:
Sorry for the newb question, but it is: going through first steps I fond this exception. Have no idea, my rails version is 2.3.5 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2009 Jul 08
0
accepts_nested_attributes_for and has_one
Hi all, I''m seeing some unexpected behaviour in a nested model and I''m not sure if it''s a bug or if I''m doing something wrong. When assigning nested attributes, the associated object gets replaced with a new record. Example code: class Car < ActiveRecord::Base belongs_to :driver end class Car < ActiveRecord::Base belongs_to :driver end
2011 Apr 07
0
accepts_nested_attributes_for, validations, :inverse_of option on associations, and IdentityMap
This feels more like a question to ask the core list, forgive me if I trespass. I''ve been trying to help one of my cow orkers get through a sticky problem. He''s got a fairly complex nested form to update a model and its children. He''s started adding some validations, and we''ve encountered a number of issues: First he had a validation on one of the child
2010 Mar 01
3
has_many models in a form
Hi, guys. There are four models in the program, A has_many B through C, B has_many A through C, A has_many D, D belongs_to A. I have a form to create A. Inspired by Ryan Bates'' railscasts I was able to create A and D in the same form, and link A to B(created beforehand) through C in the same form as well. Is it possible to create A and B in the same form? Thanks in advance. -- Posted
2010 Jan 31
3
Removing scaffold?
Hi, I just created a new scaffold in my app using the nifty-scaffold plugin. However, I messed up the syntax and forgot the model name, so it ended up being called "Title:string". I now can''t run any tasks from the terminal as I get the following error: vendor/rails/activesupport/lib/active_support/inflector.rb:352:in `const_defined?'': wrong constant name
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
2012 Nov 29
3
Proposal: faragment cache with :if / :unless conditions
Hi, I''m wondering if it would be a good idea to have fragment cache to allow options :if / :unless to determine whether or not to actually perform caching on the given block. It would actually be a good idea in my opinion right now, since I''m working on a piece of code that would benefit by this feature. The scenario is the following: I have a partial, which is
2011 Feb 28
3
Feature: ActiveResource - Adding associations through reflections
Hello everyone, I''m new in contributing and i saw in the contributing-guides, that i have to write an email at this list. I hope, that''s the right place for this. If it''s not, i''M really sorry.. ;) Could someone please give me feedback about this lighthouse-ticket?
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