similar to: Validating the presence of two associated objects from both models

Displaying 20 results from an estimated 20000 matches similar to: "Validating the presence of two associated objects from both models"

2010 Feb 01
3
validating both sides of a has_one relationship breaks pickle/machinist tests
A lot has been posted about validation issues with associations, however, I don''t see this issue addressed specifically. ex: class Foo has_one :schedule, :dependent => :destroy validates_presence_of :schedule class Schedule belongs_to :foo validates_presence_of :foo_id this creates a circular dependency that breaks test frameworks like pickle and machinist. At first I was
2009 Jul 04
9
prevent orphan records
If I have belongs_to :user Do I need to have validates_presence_of :user_id ? Does Rails validate the presence of :user_id automatically if I have belongs_to :user? In other words, does Rails prevent against creating orphan records that belong to non-existent users? Thanks. -- Posted via http://www.ruby-forum.com/.
2006 Apr 14
1
Validating Existing Models
I''ve got a user object which has quite a few attributes mapped to the database. As of right now I''ve got some validations in the model like: validates_presence_of :password, :message => "You must specify a valid password." validates_confirmation_of :password, :message => "Password doesn''t match the confirmation." validates_presence_of
2010 Jan 12
8
tips on how to write a controller test for models associated with currently logged in user
I have a controller test here: http://gist.github.com/275616, which works fine when account is an independent model, however I want: an account to be a property of user, ( and created and associated when a user is) when the user goes to /account/edit it should on edit the account of the logged in user - I can make rails do this, but I''m utterly baffled how I should alter this test to
2005 Oct 12
4
Validating 2 related models at once not working
Hello, I have a form that submits data to two related models/tables. One is Customer the other is Address. Validation for Customer works fine but not for the Address. Class Customer < ActiveRecord::Base has_one :address validates_presence_of :login, :password, :email validates_associated :address end Class Address < ActiveRecord::Base belongs_to :customer validates_presence_of
2010 Dec 14
5
Build associated model confusion
I''m new to Rails3, and I''m just trying to get one last thing to work before I call it a night. The situation is the following (please if the code is horrible, just let me know, still learning): I want to log a dive. I might have a new location on that dive at which point I have to create a new Location, and then create the dive. A dive has_one location. A location has_many
2005 Sep 27
2
No Custom Validation
Hi, Correct me if I am wrong but there doesn''t seem to be an easy way to add validation outside the pre-built ones (validates_presence_of, validates_lenght_of, etc.). Ideally there should be something like: Class Person < ActiveRecord::Base validates :my_method, :on => create, :message => ''was not valid'' def my_method(param) false unless
2008 May 07
1
validating ambient.temperature from APC IEM (AP9618, AP9619) patch
Hi Dmitry and the list, would you (or anyone owning such a device) be able to validate the below patch: https://alioth.debian.org/tracker/index.php?func=detail&aid=310613&group_id=30602&atid=411542 Most notably, it's about the paths changes: -#define APCC_OID_IEM_TEMP ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.0" -#define APCC_OID_IEM_TEMP_UNIT
2013 Sep 27
1
lock order reversal in 10-alpha2
After booting from a 10-alpha2 disk I am seeing "lock order reversal" messages show up from time to time. Current logs have 35 entries. The machine normally is running 9.1 from zfs root and I have setup a separate disk (eSATA case connected through backplane port to onboard SATA port) that I have installed 10-alpha amd64 onto a ufs partition to test port building with. I started by
2006 Feb 02
1
circular table refs in activerecord
I cannot find this anywhere, and it is holding up a project. I have a *very* simple rails app with three tables, one of which is the users table: users: Column | Type | Modifiers ---------------+-----------------------------+----------------- id | integer | not null default nextval(''public.users_id_seq''::text) login
2006 Feb 07
1
MeetMe - Party's are not exchanging Audio - Is this BUG?
Hi All, I observed the following in my try towards Multiparty Conferencing. I am establishing the Multiparty Conferencing through Asterisk Manager API. I have two users SIP/111 and SIP/101 of which SIP/101 is treated as leader. Following commands are used - Action: Originate Channel: SIP/111 Application: MeetMe Data: |edwx ActionID: ffe4563 When I use the above, Incoming call will
2009 Sep 01
5
Deep nested associations on the same Model
This could be a lot simpler than I think and I''m just missing something obvious! I''m working on a creative collaboration app whereby one user could submit a Story and this can then be forked by another user and worked on seperately. To acheive this I have a has_many association within the same Story model as such: class Story < ActiveRecord::Base has_many
2008 Sep 25
3
virt-install HVM with url and kickstart?
I have a kickstart file created that works great for installing CentOS on PVM''s and now I want to use it for HVM''s as well. The problem is that when I attempt to run the install, it seems to ignore the kickstart and starts prompting me for all the things I already have specified in the kickstart. Any idea what I could be doing wrong? Here is the command im using to get things
2013 Nov 14
6
validates :boolean_field, presence: true misconceptions
Last night a friend of mine started ranting about validates_presence_of :boolean_field returning not valid when the boolean field is false. I checked the rails issues and this seems to be a pretty common concern about the naming of ''presence'' . Instead of changing the behaviour of the presence validator, I was wondering if maybe the answer to avoid such misconceptions could be
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship would very much appreciate the help, not sure what im doing wrong at all. Scheme.rb class Scheme < ActiveRecord::Base validates :schemename, :presence => true belongs_to :user has_many :levels, :dependent => :destroy has_and_belongs_to_many :works end Work.rb class Work < ActiveRecord::Base
2009 Sep 30
17
Apache2.2 + what to get Rails
Me: not experienced with Rails or Ruby, Problem: Ubuntu 9.04 server in my shop ...couldn''t get Apache2.2 + Passenger + Rails to work for Redmine. (No answer at Redmine list and I don''t think its their problem anyway). Also couldn''t get Apache2.2 and just Rails to work, though some people said it would. Webrick works. Goal: run Redmine on a server that also runs PHP
2022 Jan 31
1
[Announce] Samba 4.16.0rc2 Available for Download
Release Announcements ===================== This is the second release candidate of Samba 4.16.? This is *not* intended for production environments and is designed for testing purposes only.? Please report any defects via the Samba bug reporting system at https://bugzilla.samba.org/. Samba 4.16 will be the next version of the Samba suite. UPGRADING ========= NEW FEATURES/CHANGES
2022 Jan 31
1
[Announce] Samba 4.16.0rc2 Available for Download
Release Announcements ===================== This is the second release candidate of Samba 4.16.? This is *not* intended for production environments and is designed for testing purposes only.? Please report any defects via the Samba bug reporting system at https://bugzilla.samba.org/. Samba 4.16 will be the next version of the Samba suite. UPGRADING ========= NEW FEATURES/CHANGES
2010 Dec 28
0
HABTM associated record presence validation
Given a HABTM relationship, for example between Products and Categories, is it appropriate to add a validation such as the following? # product.rb validates :categories, :presence => true This works for me. If there''s not at least one associated category then validation fails, and if there is then it passes. However I''m wondering if it''s correct or if there might
2007 Oct 01
3
How to beat Google aka Xapian & Natural Language Processing.
Xapians! If tomorrow Xapian search engine would achieved the same performance and result in searches as Google we would not be able to beat Google, because we would create only a copy of the searches that already exists from Google search engine. However there is a way to beat anyone, and there is a way to beat Google successfully as well just do not give up. Some see it as implementing Ajax, or