similar to: validates_associated problem

Displaying 20 results from an estimated 500 matches similar to: "validates_associated problem"

2006 Nov 19
1
score for wildcard searches
Hello All, I have a rails app that maintains movie data index and uses "acts_as_ferret" for search. I ran into an issue with the scoring of wildcard searches. When I search for word "super*", the record containing the word "superman" is ranked above the one having just "super". Is this normal or am I missing something? Any ideas on how scoring can be
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
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 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
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
2006 Oct 14
2
issues with validates_associated not throwing error
Hello all I''m having an issue with ruby on rails, and it not throwing an error where it should. I have a class ''clientpool'' that is: class Clientpool < ActiveRecord::Base set_table_name "clientpool" set_primary_key "id" belongs_to :clients, :foreign_key => "cliname" validates_presence_of :cliname validates_associated :client end
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 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2006 Apr 26
1
Bug in validates_associated?
Here is the setup: Windows XP, InstantRails, MySQL 14.7, Ruby 1.8.4, Rails 1.1.2 MODEL: class Office<ActiveRecord::Base has_many :users end class User<ActiveRecord::Base belongs_to :office validates_presence_of :office_id validates_associated :office <....other stuff...> end UNIT_TEST test/unit/user_test.rb def test_associations u = User.new u.office_id =
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
2009 Oct 27
5
Unwanted call to validates_associated
In my schema, a question has_many :answers. When the validations are run on a question, and one of the answers is not valid, then i get "Answers is not valid" coming out of errors.full_messages. I don''t want this, i''m already testing the validity of the answers and this is an ugly and uninformative error message. It looks like it''s the message i would get
2006 Aug 17
2
validates_associated bug?
i seem to be experiencing a bug where rails tells me that my organization object''s associated credit card is invalid (activerecord validation-wise invalid), when i know it to be valid. this happens only if i tell the organization to validate_associated :credit_card. i know the associated credit card is valid, because a) that credit_card object itself throws no validation errors, and b)
2008 Mar 11
1
add_multiple_associated_save_callbacks and validates_associated conflict?
Perhaps I''m misunderstanding what''s happening here, but I''m having a problem with not being able to disable the validation of an associated collection if that collection contains a new record. Example... class Person < ActiveRecord::Base has_many :email_addresses validates_associated :email_addresses, :if => Proc.new { false } end p = Person.new
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2008 Feb 03
1
ActiveRecord object.valid? triggers unexepected results
I''m editing an ActiveRecord object in a session through AJAX, updating it with object.attributes = params[:object], and validating it with object.valid? Because it''s associated with other objects in a form, I want to save them all together. The surprise was that object.valid? triggers after_validation_on_update. I''m having an audit log and I was getting bogus entries.
2006 Nov 08
4
writing SQL query WHERE.. IN.. anArray ?
I have an array @dpt_ids ex : @dpt_ids = ["43", "48", "49", "50", "51"] I try to insert it into my sql query to be used in a ''find_by_sql'' query = "SELECT * , #{kms} AS km FROM cities" query << " WHERE department_id IN ( #{dpt_ids} ) " but this transform my array into a unique string :
2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign key? The problem is, I can''t check if the attribute is a valid foreign key if the attribute doesn''t even exist. For example, every employee must be in a department. In the following code, if an employee''s department_id is not present then Department.find_by_id(department_id) might cause
2006 Jun 21
1
Migration with foreign key won''t work
Hi all I use the plugin which supports foreign keys with migrations: http://wiki.rubyonrails.org/rails/pages/Foreign+Key+Schema+Dumper+Plugin/versions/12 I have created the following migration file: class AddArtistsTable < ActiveRecord::Migration def self.up create_table :artists, :force => true do |t| t.column :name, :string, :limit => 100 t.column :artist_type_id,
2017 Apr 12
2
PJSIP logging fails
I am trying to log my SIP registration attempts. PJSIP is in logger mode, and I can see INVITES comingh, my SIP Register does not show, especially the packet I send. The only thing shown is: res_pjsip_outbound_registration.c: No response received from 'sxxxxnet' on registration attempt to 'sip:7866314772-xxxxxnet', retrying in '60' How do I see my own packet? --------------
2009 Jul 17
8
Tools to take a kernel crash dump.
Hello Everyone, We have noticed that one of our servers xen Dom0 is restarting idiopathically. Atleast, we are not able to analyze the cause. I have checked the logs but couldn''t find anything relating to it. Are there any tools such as kdump (which doesn''t seem to work on xenified kernels) for catching the kernel crash snapshot. Regards, Sree Harsha Totakura Member, Open