Displaying 20 results from an estimated 1000 matches similar to: "accepts_nested_attributes_for and has_one"
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 %>
2001 Jan 02
0
ogg123: close_dsp_on_suspend and next_on_SIGUSR1 patches submission
Hi,
A developper of MandrakeSoft needed for some reason to ameliorate ogg123
in a way: with the patch when you issue a Ctrl+Z (suspending the app) the
dsp is freed. Ofcourse the app can still continue when SIGCONT is
received.
Apparently he chose to separate the actual code into more functions.
Please note that this code uses local functions, it thus needs gcc to
compile.
-=-=--
---
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
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 Oct 13
3
Validation errors in has_one/belongs_to relationships.
I have two objects, QuoteInput and Insured.
QuoteInput has one Insured and Insured belongs to QuoteInput.
I don''t understand what I''m seeing.
I assign an Insured to a QuoteInput. The Insured object has invalid
data.
I call save! on the quote input. QuoteInput has no validations.
I expect two things to happen - 1) an exception should be thrown,
indicating that there was a
2012 Aug 01
2
'redirect_to' taking infinite loop.
Hi,
The following controller method taking me into infinite loop. Once the
update action completes I want to reload the ''index'' page. May I know
why it is going into infinite loop?
def update
Device.find_by_id( params[:device_id] ).driver = (
params[:driver_id] == 0 ) ? nil : Driver.find_by_id( params[:driver_id]
)
redirect_to :action => :index, :tab =>
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
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
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
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,
2002 Nov 03
0
python bindings and ao lockup
Hello, I hope this is the right place to ask.
I am having random lockups from the python bindings. My app has one or
two threads running, the lockups only occure at one point, here is the
code run as a thread
def play(self):
self.playing = TRUE
self.output = []
self.lastplay = time.time()
args = self.song_file, self.output
retval =
2000 Dec 30
1
selecting driver for ao
I added a couple of functions to my copy of ao.
int ao_get_driver_count(void);
const char * ao_get_driver_name(int index);
With these, I can get a list of drivers and give the user a choice
by using radio buttons, e.g.
[ ] alsa
[*] oss
[ ] esd
[ ] null
[ ] wav
This is a lot nicer than just asking them to enter the name of
the driver.
Here's the code I added to audio_out.c:
const char *
2012 Apr 05
0
Warning message: Gamlss - Need help
Hi,
I am running a negative binomial model using Gamlss and when I try to include random effect, I get the following message:
Warning messages:
1: In vcov.gamlss(object, "all") :
addive terms exists in the mu formula standard errors for the linear terms maybe are not appropriate
2: In vcov.gamlss(object, "all") :
addive terms exists in the sigma formula standard
2007 Mar 12
2
Request for comments/testing: upsc_list branch
I finally got some time to implement a pair of options to upsc for
listing all configured UPSes on a given upsd:
http://boxster.ghz.cc/projects/nut/changeset?new=branches%2Fupsc_list%2Fclients%2Fupsc.c%40859&old=trunk%2Fclients%2Fupsc.c%40821
http://boxster.ghz.cc/projects/nut/browser/branches/upsc_list/clients/upsc.c?rev=859
I think this should work with the new functions for parsing IPv6
2009 May 25
4
after_create and has_one association bug?
Hello,
I''ve come across an issue that I''m sure is a bug when using after_create
with a has_one association, but I''m not 100% certain if I''m missing
something.
This is pretty much exactly the code I''m using. Two simple classes
(Account and Contact) and I create the contact after I create an account
(via after_create). I''m not passing in a