Displaying 20 results from an estimated 800 matches similar to: "Ensuring that foreign key is valid"
2009 Nov 17
2
rake db:seed with authlogic fails to populate users
I have a db/seeds.rb file that I want to load, but while the rest of the
seeds file works fine, nothing is ever populated in :users. I just fails
silently, so I can''t figure out what exactly is causing the problem.
I have authlogic installed into the user.rb model with
acts_as_authentic. I''m sure that''s part of the problem, but I''m not sure
that manually
2009 Nov 14
3
authlogic fails on existing accounts when crypted_password is blank
I recently ran a migration to add the following to an existing user
model:
t.string "crypted_password"
t.string "password_salt"
t.string "persistence_token"
There is an existing (cleartext) password field, but authlogic doesn''t
seem to be reading that on existing accounts. As a result, all logins
for existing accounts fail.
How can I get
2009 Nov 20
3
Proper usage of identify(label)
I was reading this page:
http://api.rubyonrails.org/classes/Fixtures.html#M000326
and was trying to get hashed labels working. However, calling it from
within a unit test results in this error:
def test_defaults_to_disabled
identify(''one'')
end
2) Error:
test_defaults_to_disabled(AdminTest):
NoMethodError: undefined method `identify'' for
2009 Nov 20
3
Javascript Confirm for Form Value
How could I ask a user to confirm specific form input?
EX:
<%= f.submit ''Donate'', :confirm => ''Confirm your donation amount:
###amount###'' %>
Where the ###amount### would be replaced with the amount entered in
the form.
Thanks,
Dustin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2009 Dec 02
14
root_path and root_url undefined
Hi all,
I''ve just started working on another RoR project after a couple of months
away. I''m having trouble with named routes, specifically root_*
In previous apps I''ve used root_path and root_url without any problems, but
in this project (2.3.2 - the same as my last project where I used it) it
comes up undefined.
I''ve double and triple checking my routes.rb,
2011 Feb 18
1
Rails plugins new official maintainers
Hey guys,
This is the final list of the new maintainers of each plugin.
We need two more things to do:
First please the owners of the repos add the rest of the maintainers.
Second I will add a note on each rails/plugin mentioning this repos updates.
So from now on, if someone else is interested in helping/contributing
please send a message to the appropriate repo owner.
verification
2009 Nov 28
1
user management in ROR
Hi,
I am newbie for ROR and designing user management system, Which
includes all features including register , Profile of user , Profile
view of user, Inbox,Mails, .Please suugest some useful code links for
the same . and if you have any code for the same please help me. I
only create user registration system, Thanks in advance.
--
You received this message because you are subscribed to the
2007 Jul 12
2
[AVS] Question concerning reverse synchronization of a zpool
Hi,
I''m struggling to get a stable ZFS replication using Solaris 10 110/06
(actual patches) and AVS 4.0 for several weeks now. We tried it on
VMware first and ended up in kernel panics en masse (yes, we read Jim
Dunham''s blog articles :-). Now we try on the real thing, two X4500
servers. Well, I have no trouble replicating our kernel panics there,
too ... but I think I
2006 Mar 13
3
validates_associated problem
Hello,
I have a situation where an ''employee'' belongs to a ''department'' and
have setup the relationship as follows.
class Employee < ActiveRecord::Base
belongs_to :department, :foregin_key => "department_id"
validates_associated :department_id
end
class Department < ActiveRecord::Base
has_many :employees
def validate_on_update
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated...
Let''s say I have:
article belongs_to author
But for whatever reason, I want an article to also be written
anonymously and therefore not require an author. Then I have:
Article:
belongs_to :author
validates_associated :author
But I DON''T have validates_presence_of. What I want to do is validate
that an author is valid --if it is
2008 Jul 01
6
validates_associated & foreign keys
Hi,
I''m struggling to get the validates_associated to work as I think it
should be.
I''m using:
JRuby 1.1
rails-2.0.2
activerecord-2.0.2
activerecord-jdbc-adapter-0.8.2
My tables in MySQL:
CREATE TABLE area_codes (
id INT UNSIGNED auto_increment primary key
...
);
CREATE TABLE markets (
id INT UNSIGNED auto_increment primary key,
...
);
CREATE TABLE
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
2006 Mar 18
1
has_many and validates_associated
By trial and error I seem to arrive to the conclusion that
1. Validation recurses through has_many by default and
a root save! call raises an excepcion if some child no
matter how nested is fails validation
2. Validation does not recurse through has_one by default
and you can change this with validates_associated, in
which case exceptions behave like above
2008 Jun 29
2
How to write test about validates_associated
Here is my model:
class Account < ActiveRecord::Base
has_many :users, :dependent => :destroy
has_many :bus
belongs_to :currency
has_many :mylogs, :dependent => :destroy
has_many :batchuserdefines, :dependent => :destroy
has_many :materialuserdefines, :dependent => :destroy
has_many :materials
has_many :inventories
has_many :batchs
has_many :courses
has_many
2013 Feb 13
3
conditional validates_associated
Hello,
Have you guys noticed that conditional validation with validates_associated
does not work well when you are creating a new record?
Consider this gist: https://gist.github.com/aflag/4780225
The Lawyer class has validates_associated on address conditioned on whether
the Lawyer data comes from a known source or not. So, if lawyer.source
equals to some string, then lawyer.address must
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all,
I am a newbie to Rails. Please enlighten me on how to do this
appropriately, the Rails and the Ruby way:
Suppose I have a Recipe model. Let''s simplify things and pretend that
it has only 2 attributes, a :name and the other is a ''category_id''. In
the recipes table, category_id is a foreign key to field id of table
categories.
We also assume that I have generate
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 Mar 02
1
Problem after reboot
Hello all,
Rebooted my server by mistake (don't ask...) - everything was working OK
before the reboot, but after the reboot, NUT stopped working - so had a
look and I found I couldn't track the exact problem - I'm quite stumped
as there's nothing indicating that there's a problem, but it just
doesn't work...
In a nutshell....
destiny:/usr/local/ups/bin# ./upsdrvctl
2006 Mar 02
1
Problem after reboot
Hello all,
Rebooted my server by mistake (don't ask...) - everything was working OK
before the reboot, but after the reboot, NUT stopped working - so had a
look and I found I couldn't track the exact problem - I'm quite stumped
as there's nothing indicating that there's a problem, but it just
doesn't work...
In a nutshell....
destiny:/usr/local/ups/bin# ./upsdrvctl
2005 Oct 26
2
validates_associated ... doesn't
Hi,
I think I''m missing some fundamental information here so hopefully
someone can help me. I have a model Club which has many members,
members of course belong to a Club. I''d like to ensure that when a
members is saved (saved/created/updated) only valid club_id''s are accepted.
I have a Club model (simplified) like this:
class Club < ActiveRecord::Base