Displaying 20 results from an estimated 80000 matches similar to: "form with saved and new model instances"
2006 Sep 24
8
form_for and Multiple Models Being Saved
Howdy Folks,
I want to use form_for to allow a user to submit a form that contains two
instances of the same model. They are entering calendar dates and I want
them to be able to submit 2 from the same form.
Ok, so, using form_for, what is the best way to do this? form_for seems to
be setup to handle a single instance in that it wants a name for the
variable, etc...
Has someone else done this?
2008 Apr 23
1
Validation dependent on unsaved parent
I''m having trouble with a validation that depends on an attribute of a
belongs_to parent. If the child is added to an unsaved parent
(parent.children << new child), the has_many collection
parent.children includes the unsaved child. However the belongs_to
attribute child.parent appears to be nil until the parent has been
saved. Without access to the parent attributes, the validation
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object
was newly created?
Hopefully this will explain my question:
A Firm class declares
has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients
and a
client class declares
2005 Dec 30
0
Best way to handle associated object creation WithIN the SAME form ?
hi,
let''s take a very simple example.
2 tables: people and phones
One person has_many :phones
One phone belongs_to :person
(the phone table contains a person_id)
i began with the classical scaffold generator for the main form (the
people form)....
How can i add a phone , associated to the NOT YET SAVED person objet ,
with an ajax mean?
do i have to put the unsaved person in session
2013 Feb 06
0
inverse_of breaks for unsaved child associations during save of parent
I''m willing to write a patch for this issue:
https://github.com/rails/rails/issues/8893
But want to confirm that the new behavior makes sense before I make the
effort.
Essentially if you have an unsaved parent and child, and the parent''s
association to the child has an inverse_of declared on it. When the parent
gets saved, it updates the foreign key on the child, and this
2006 Mar 13
2
relationship woes
I have two tables:
class PgmUpdate < ActiveRecord::Base
has_many :pgm_visits, :foreign_key => ''pgm_update_fk''
...
and
class PgmVisit < ActiveRecord::Base
belongs_to :pgm_update, :foreign_key =>
''pgm_update_fk'', :dependent => true
...
According to the has_many docs (http://api.rubyonrails.org/classes/
2006 Dec 21
0
Autocomplete field in form - need string to be displayed but :id to be saved.
Hi all,
Here''s what I am trying to do. I need autocomplete text field in a
form. There are 10,000 names to choose from. But when selected I don''t
want the string to be saved but the :id attribute of the model. How
can I show the string in the text_field and then swap it out for the
:id before a create or update. I see that the customized version on
scrip.aculo.us has both name
2004 Dec 08
2
configure dual samba 3.0.8 instances-one fedora box
Greetings,
I've a need to run 2 instances on one box. I've spent the better part
of 2 days looking for docs and howto's and reading the FM. However, I
think I'm making too much out of it, thinking that there is more to it
than there really is.
the first instance is to serve the users, the second instance is for
the backup system.
I'm running fedora core 2 with samba
2008 Apr 28
1
OSX R GUI visual interface tweak (PR#11318)
Full_Name: Ana Nelson
Version: R 2.7.0 GUI 1.24 (5102)
OS: OSX 10.5.2
Submission from: (NULL) (213.94.201.89)
The R GUI close button has a solid circle. Screenshot is here:
http://skitch.com/ananelson/kmxj/r-console
On OSX this indicates that there are unsaved changes pending. Please see page
201 of the Apple Human Interface Guidelines (version 2008-03-11):
2008 Nov 05
0
0 errors prohibited this model from being saved
Hi,
I just generated a scaffold for some existing models I have, and
everything is working fine, except I get a 0 error message on the edit
view:
--------
0 errors prohibited this statistic type from being saved
There were problems with the following fields:
--------
I would have thought the default behaviour would be to hide this error
message if there are no errors, and that is my impression
2005 Dec 22
0
Errors object missing when saving AR in Web Services method
Hello,
I''m not able to get Errors object when saving some Model instance in
ActionWebService::Base subclass.
I want to create API method that will return ID of the object when saved
successfully. When validation fails and the object is not saved I''d like
the method to return ID, as well as the array of ValidationError custom
struct. But I cannot fill in this because unsaved
2017 Dec 14
0
multiple instances of predictor variable per model
I?m running a model on animal behavior in response to shipping. In most
cases, there is only one ship in the study area at one time. Ship length,
distance from the animals, speed, angle from animals, and ship direction
(as east/west bound) are among shipping-related covariates (with multiple
interactions).
The tricky part is that sometimes there are 2 ships in the area. I could
add all the same
2005 Dec 27
1
How do you detect if ''update'' save fails?
So I''m updating multiple model objects in one go with something like
this in my controller:
=> Photo.update(params[:photo].keys, params[:photo].values)
When the update fails due to validation errors, how do I detect it?
The Rails API says:
"If the save fails under validations, the unsaved object is still
returned."
So I can''t simply do this:
=> if
2006 Jan 16
7
Editing N instances of a model on one page
I have a situation where I want to edit an arbitrary number of instances
of one model on one page. I can and have accomplished this by manually
managing the object <-> text field relationship, but in a way I consider
at best hackish. I''d like to know a clean way to do this.
If you want to edit the name attribute on a person class, you write code
like this
2007 Jul 26
1
Lohan the observable
Sorry, that name is a misnomer. However, I was excited to find that Ruby
has a built in Observable module and I''m pretty bored, so I apologize in
advance....
require ''observer''
# one who is observed
class Celebrity
include Observable
attr_accessor :name
attr_reader :is
def is=(val)
@is = val
changed
notify_observers(self)
end
end
# one who
2010 Feb 02
2
[LLVMdev] Crash in PBQP register allocator
Hi Sebastian,
> I think the crucial point is that node4 isn't aware of its own
> restriction (after the first R2 reduction).
> If you normalize the new matrix (shifting costs in the adjacent vector
> until each row/column has minima 0) after a R2 reduction of a node with
> infinite spill cost the problem should disappear.
<snip>
> Did you consider this option?
We
2006 May 26
3
validate a form NOT connected to a model
Is there any way to validate a form that isn''t connected to a model. I have
a form that connects to a controller action and I want to validate the
inputs on the form like I would with the validates_ATTRIBUTE_of property on
a model. Is there any way to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2020 Jan 29
2
Model object, when generated in a function, saves entire environment when saved
Reviving an old thread. I haven't noticed this be a problem for a while
when saving RDS's which is great. However, I noticed the problem again when
saving `qs` files (https://github.com/traversc/qs) which is an RDS
replacement with a fast serialization / compression system.
I'd like to get an idea of what change was made within R to address this
issue for `saveRDS`. My thought is that
2010 Feb 02
0
[LLVMdev] Crash in PBQP register allocator
Lang Hames wrote:
> Hi Sebastian,
>
>
> We did. The success of normalization in this case depends on whether
> you attempt to normalize rows first, then columns, or the other way
> around.
>
> Currently rows are normalized first, then columns. In your example the
> infinite costs are thus propagated onto element 1 of node 0, rather
> than node 4, which leaves us
2007 Aug 27
0
layout not seen by some clustered mongrel instances
Hi --
I have setup a fairly simple Rails site. It uses a layout and 4
clustered instances of Mongrel running on ports 8001 through 8004.
The instance of Mongrel running on port 8001 seems to work perfectly.
For some reason, the other 3 instances Mongrel are behaving as though
they don''t see the layout. Does anyone know why that is; and, more
importantly, what to do about it? Thanks.