Displaying 20 results from an estimated 40000 matches similar to: "How to Validate Inherintly?"
2006 Jan 15
6
PROPOSAL: Validations as Mixin
It seems to me that Validations are quite useful for many objects, even
ones having nothing to do with ActiveRecord.
Common examples are Contact Us forms, multi-step forms, web service
paramater validations, etc.
I took a look at the source for Validations, and it seems that it is
very independent from ActiveRecord. I caught only three depenedencies:
1. validates_numericy --> depends on
2011 Nov 02
2
Specify and validate requirements on an ActiveRecord association
Looking for some guidance/support on what feels like might not be an
uncommon use-case.
`User.has_many accounts`
`User.has_many payment_methods`
`Account.belongs_to :user`
`Account.belongs_to :payment_method`
`PaymentMethod.has_many :accounts`
There are lots of `Accounts`. When I (a `User`) want to assign
accounts to a `PaymentMethod`, I really don''t want to scope against
all of them,
2005 Nov 28
4
validates_format_of nil
I''ve noticed that validates_format_of will return invalid if the field
is nil.
Question 1) How should we declare a validation that will validate it
with a regex if it is set, but, if the field is not set, just move on
Question 2) Why is it done this way? The other validators are only
invoked if the field is set . If you want to declare the field
mandatory, you add a
2007 Jul 06
2
validations of "type" when using Single Table Inheritance
Sorry if I''m just dumbing out, but is there a reason that when using
Single Table Inheritance Rails doesn''t really validate the "type"
field or provide some mechanism to do so? seems like a good way to
corrupt a database. Because the "type" is also a special attribute, I
had to resort to an ugly hack like:
class ActiveRecord::Base
def type_attr
2005 Nov 09
0
OggPCM proposal feedback
On Thu, Nov 10, 2005 at 10:13:19AM +1100, Erik de Castro Lopo wrote:
>
> a) There is no marker to distinguish little endian data
> from big endian data.
The original reason for this is because Ogg makes such a matter moot,
since the bitpacker in libogg2 handles endian.. however, if a "chunk"
packer is made available (similar to memcpy), this becomes important
since
2012 Feb 18
3
[LLVMdev] We need better hashing
On Fri, Feb 17, 2012 at 1:32 AM, Chris Lattner <clattner at apple.com> wrote:
> On Feb 17, 2012, at 12:26 AM, Talin wrote:
> > OK here's a patch with the latest, including unit tests. I've also tried
> to make the comments clear that this is intended for the case of "generic"
> key types, where you are either hashing multiple data types together, or
> you
2014 Jul 17
2
[LLVMdev] [RFC] Invariants in LLVM
On 07/17/2014 01:51 PM, Chandler Carruth wrote:
>
>
> 2. Would adding a canonicalization of if(c) { unreachable } to
> llvm.invariant(c) would be worthwhile?
>
>
> There was a long and painful attempt to implement invariants based on
> the branch-to-unreachable pattern. It didn't work. I don't expect
> these patterns to show up often organically and to
2006 Jun 25
0
Using the database schema to help validate data
I started working on this in response to Dave Thomas'' keynote as
RailsConf 2006. This little patch will validate that your text fields
will fit into the database. Obviously this is just a start, and many
more validations could be added. Also, this code could probably be
extracted into a plugin instead of patch to ActiveRecord.
Index: test/validations_test.rb
2006 Jul 30
1
FileColumn - Validate Before Saving
file_column is great -- but I need a way to run through the validations
(ie: validates_file_format_of) before saving. That is, when a user first
uploads an image it is displayed in the view but not ''saved'' until they
click the ''Save'' button on the form. I want to display an error
message/disable the ''Save'' button if the file they just
2005 Nov 09
0
OggPCM (uncompressed Ogg audio)
On Wed, Nov 09, 2005 at 09:31:29AM -0800, Ralph Giles wrote:
> >
> > I am open to eliminating it, if it can be shown that the act of reading or
> > skipping this data complicates implementation or makes it less efficient,
> > however, the decidion to do so should include several people (Monty, Ralph, etc)
> > who haven't joined this discussion yet.
>
>
2006 Jan 14
1
form fields WITHOUT table columns? Can we validate these in the model?
I would like to have a field on a form that does *not* have an underlying
column in the table.
Yet I would like to perform some validation on the value. I would like the
results of the validation to show up
just like the validations that are performed in the model.
This is very similar to the password_confirmation field on a sign up screen.
The password_confirmation is
there on the screen, but
2006 Dec 16
2
Validate some fields only on object creation, not update
I''m having a problem with my User model. Originally I had alot of
validation, including this:
validates_presence_of :password_confirmation, :password
validates_length_of :password, :within => 4..50
validates_confirmation_of :password
However, this made it impossible to edit a user without setting his
password, which I don''t want. So I tried to isolate the above
validations
2006 Apr 27
0
DRY validation
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
A few months ago someone posted a message about specifying validates_*
constraints on a per-attribute basis. I just created a small plugin
that
allows you to do this.
Here''s an example from one of my models:
class Country < ActiveRecord::Base
attribute :name, :string do |a|
a.validates_length :within =>
2017 Jan 04
0
Formulating Advanced Queries with Xapian-Omega
On Thu, Dec 29, 2016 at 05:44:50PM +0100, Giulio Teslano wrote:
> a. What other types of extended wild card(s) options are there ?
>
> or is this still currently limited to these two characters '*?' ?
As I said, the branch "adds support for arbitrary glob-style wildcard
patterns (where * matches 0 or more characters and ? a single
2005 Dec 18
8
Log viewer for colorized logs
Is there a decent log viewer for colorized log files?
less -r for me doesn''t work well, as it sometimes clears the screen.
I''d like:
* Either a console type less viewer which just removes the colors
* Or, even better, a console one which handles the colors without
clearing the screen
* Or, best of all, a GUI viewer - maybe even with color
I use both Windows and Linux.
2012 Feb 17
0
[LLVMdev] We need better hashing
On Feb 17, 2012, at 12:26 AM, Talin wrote:
> OK here's a patch with the latest, including unit tests. I've also tried to make the comments clear that this is intended for the case of "generic" key types, where you are either hashing multiple data types together, or you don't know in advance what the data type will be - for cases such as strings where a tailored algorithm
2014 Feb 21
1
pdbedit -e broken
I am trying to export my samba password database using
pdbedit -e smbpasswd:smbpass
Mixed in with successful accounts are many errors:
Importing account for bob...ok
build_sam_pass: Failing attempt to store user with non-uid based user RID.
Importing account for fred...failed
Importing account for brian...ok
1) Why does it say "importing" when I am exporting?
2) How do I correctly
2006 May 28
0
Best way to validate these dropdowns/multiselect options
Hi,
I have a <form> page in which there are a number of dropdowns and
multi-selects, each of which is populated upon the page loading by
quering its own table with the most recent values. These other tables
are very simple two-column set-ups - one for the ID/value and another
for the verbose description.
I am getting the editing/creation stuff working fine. The dropdowns work
with a
2006 May 17
0
How to validate in_place_edit updates
Can anyone enlighten me on how to make in_place_edit fields go through validations that are defined in the model? For example, my customer model has a "validates_numericality_of phone", but when the in_place_edit is done you can enter whatever you want. The field is defined as a string in the DB. I can''t change the database schema, due to other constraints, so I need a
2012 Jan 17
0
What is the best way to validate a json object? (POST request)
I must create a class (JobClass) and include ActiveModel::Validations?
and then
valided = JobClass.new(params).valid?
The JSON body :
http://pastebin.com/TwRbydmq
I can not create rules corresponding to the validation of the field
"method" ... It can be "concat" or "split" but it is not the first
level.
How can I do?
Thanks
--
Posted via