Displaying 20 results from an estimated 2000 matches similar to: "validates_presence_of fields. in parent ok, but how in children?"
2006 Apr 07
2
errors.add_to_base
What are the limitations on using:
errors.add_to_base
to display errors in views?
I have tried for days to add errors from my object.rb and they never get 
displayed.
class Keyword < ActiveRecord::Base
    validates_presence_of(:name, :message => "Name is required.")
    validates_uniqueness_of(:name, :message => "This name is already in 
use. Please try
2006 Aug 10
4
I need "validates_presence_of" help
Hi - I have 3 fileds a user can fill out. They can fill out 2 of them or 
just one of them, for example.
fill out these 2 fields:
Field1 and Field2
Or fill out this field:
Field3
In my model how do I use validates_presence_of for Field1 and Field2 or 
just Field3.
I want to do something like this:
validates_presence_of Field1, Field2
OR
validates_presence_of  Field3
So the user can fill out
2008 May 24
0
[LLVMdev] Advice on CFG pre-analysis
On May 24, 2008, at 02:53, Talin wrote:
> In the language I am working on, there are cases where the call flow  
> graph can affect the type of a variable. A simple example is a  
> "nullable" type (a pointer which is allowed to be NULL), which can  
> be converted into a non-nullable type via an if-test. So for example  
> if x is nullable, and I test x != NULL, then
2008 May 28
0
[LLVMdev] Advice on CFG pre-analysis
On May 23, 2008, at 11:53 PM, Talin wrote:
> In the language I am working on, there are cases where the call flow
> graph can affect the type of a variable.
Ok.
> A simple example is a
> "nullable" type (a pointer which is allowed to be NULL), which can be
> converted into a non-nullable type via an if-test. So for example if x
> is nullable, and I test x != NULL,
2008 May 28
3
[LLVMdev] Advice on CFG pre-analysis
Thanks (everyone) for the suggestions, they were helpful.
What I decided to do was to essentially "wrap" LLVM's BasicBlock 
structure with my own block class that contains additional high-level 
information. Up to this point I was generating LLVM basic blocks on the 
fly as I walked the statement tree; Now I build my own BB graph, and 
then use that to generate the BB graph for
2008 May 24
8
[LLVMdev] Advice on CFG pre-analysis
In the language I am working on, there are cases where the call flow 
graph can affect the type of a variable. A simple example is a 
"nullable" type (a pointer which is allowed to be NULL), which can be 
converted into a non-nullable type via an if-test. So for example if x 
is nullable, and I test x != NULL, then inside the conditional block the 
type of x is no longer nullable.
2006 May 30
0
Order parents when displaying children question
Hi,
I want to show a series of links belonging to a specific category.
The links will be shown grouped by category, but how can I alter the
order of the categories?
I have a field in my database called position with the order in which 
they
should appear.
MODELS:
class Category < ActiveRecord::Base
  has_many :links
  validates_uniqueness_of :category, :message => "already
2006 Apr 26
2
Retrieving :id without passing it
Ok, I have read most of Agile Web Dev... so I had a question about 
beautifying URLs using routes.rb. I''m trying to architect a content 
management system in which a user can create template pages. This way, 
when a user creates a template page nested within, it displays it as 
though it''s displaying a folder structure, much like a directory tree 
(using acts_as_tree).
I have a
2007 Oct 01
0
View Spec - Misbehaving
I''m trying to write my first view spec; I''ve done some controller specs with
integrated views, but thought that isolating the views for some of these
tests might be nice.
So I wrote this:
> describe PlayerContainer, "show" do
>
>   PARENT_ID = 12
>   CHILD_NAME = ''Child Name''
>   PARENT_NAME = ''Parent Name''
>
> 
2006 Mar 25
3
validates_presence_of validation order?
I have a form with 3 fields: user_id, email and password.
All 3 fields are required, so I have a "validates_presence_of :user_id, 
:email, :password" in my model.
Works, but the validation errors show up in a different order than I 
specificed in the validates_presence_of statement.
Is there a way to specify the order in which the validations (and 
corresponding error messages) should
2006 May 18
1
Introspection of validates_presence_of
Hello all.
I don''t know how to get all symbols passed to method
validates_presence_of in model. I''ve trying to use following solution:
class News < ActiveRecord::Base
  validates_presence_of :title, :text
  def validates_presence_of(*attr_names)
    @@obligatory_fields = attr_names
    ActiveRecord::Base.validates_presence_of(*attr_names)
  end
  def obligatory_fields
   
2006 May 22
2
Weirdness with validates_presence_of
Hi,
I have a call to validates_presence_of in my model and it is behaving very
strangely
my first stab when this happened during testing was
validates_presence_of :impact, :ease_to_implement if Proc.new { |record|
!record.cost_estimate.nil? }
I have three values in my model that I care about with this one.  Basically
what I''m trying to get to happen is
if one is there they all must be
2006 Mar 13
4
undefined method `validates_presence_of'' for #<ProductsContr
Hi,
I am trying to use method `validates_presence_of'' for validating my 
input fields on form . I m using it in my action class as follows:-
=======================
validates_presence_of(params[:product][:quantity])
======================
But when I am running my application i m getting error like:-
=========================
undefined method `validates_presence_of'' for
2006 Jun 07
1
validates_presence_of in a mixed-in module?
Anyone got any idea of how to use built-in validation methods in a 
mixed-in module.
What I''ve got at the moment is each class that needs ranking methods 
includes [the module] Ranking. Then the module Ranking has a bunch of 
instance methods and a submodule ClassMethods. The ClassMethods in this 
are mixed in to the class with self.included. So far so good.
But I want the module to
2006 Apr 12
0
How to get validates_presence_of worked in this situation?
Suppose:
class articles < ActiveRecord::Base
  has_many :assistarticles
  validates_presence_of :body
end
class assistarticles < ActiveRecord::Base
  belongs_to :article
  validates_presence_of :detail
end
In the submit form:
  <%= text_field ''article'', ''body''  %>
  <%= text_field ''assistarticle'', ''detail'' 
2006 Apr 23
3
Validates_presence_of in ActionMailer model
Hi all,
I want to submit the content of a form by mail.
I don''t want to save it into a DB.
How can I validates the content of this form with validates_presence_of ?
Thank you.
Damien
2008 Nov 01
2
stuck on a validates_presence_of unless issue
i have a person object. Persons don''t need to have addresses, but if
they have any address field value, they must have them all. So I have
something like this:
validates_presence_of :street_address, :city, :state, :postal_code
unless :address_blank?
address_blank? checks whether all of the address fields are blank.
If I run a test like this, it works:
  describe "given
2007 Oct 17
3
validates_presence_of validating twice?
I''m getting some weird behavior in one of my models. I have a model
defined something like this
class User < ActiveRecord::Base
  attr_accessor :password
  validates_presence_of :password
end
If I validate the model without specifying a password, I get  ["can''t be
blank", "can''t be blank"] for :password instead of just one "cant''t
2006 May 14
0
problem with validates_presence_of :on=> :update
I''m having what''s probably a stupid-newbie problem with validates_presence_of and I''m hoping someone will point me in the right direction.
Bottom line is that validates_presence_of does not seem to be ''firing'' when I use the :on => :update option.  If I don''t include the option, the validation does fire.  
The problem is that I want to
2006 May 19
1
validates_presence_of and ajax-forms
Hi.
I have "validates_presence_of :login, :password, :firstname,
:lastname" in my user-model. I enter the information in
new_user.rhtml:
<%= error_messages_for(:user) %>
<%= form_remote_tag :url => { :action => :register }, :html => { :id
=> ''new_user'' } %>
I have a register.rjs with :fade.
Omitting firstname or any other required field