Displaying 20 results from an estimated 1000 matches similar to: "Netmask validator"
2008 Mar 18
0
Major issues with ActiveRecord callbacks in BackgroundRb r324
Hi there
I''ve been running BackgroundRb in production for a few months now. Recently
we added encryption onto some of our ActiveRecord fields by hooking in the
before_save and after_save callbacks, like:
class MyCallback
def initialize(attr_names)
@attr_names = attr_names
end
def before_save(model)
@attr_names.each do |attr_name|
next if
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi,
Just wondering when one would use "include" over "extend"? Both seem to
bring in methods to the class no?
The context is I''m just trying to understand why both are used with the
acts_as_audited plugin:
Full extract from plugin (used within here):
==================================================
# Copyright (c) 2006 Brandon Keepers
#
# Permission is hereby
2005 May 04
1
Conditional validations
I''ve been working with the problem that Joe Hosteny has been talking
about on this list and on the tickets he''s posted
(http://dev.rubyonrails.com/ticket/1196) and have come up with a
tentative solution that I''d like to bring up here.
What if we use a "conditional" parameter in the validates_* methods?
Here''s how it would look like in practice:
2005 Dec 16
4
Validation with Aggregation
ActiveRecord supports composed_of for value objects which is
fantastic but one thing that it doesn''t seem to support (or at least
I am unable to find any documentation for) validation of the value
objects.
For example, given the following:
class Message < ActiveRecord::Base
composed_of :sender, :class_name => ''EmailAddress''
composed_of :recipient,
2006 Feb 24
2
Shortcircuit evaluations
This is probably a Ruby questions but since my issue exists in a Rails
validation I thought I''d post here. I have the following validator
validates_each :thumbnail, :regular do |record, attribute, value|
unless value.nil? &&
value.valid?
record.errors.add(
attribute,
2005 Apr 08
2
attr_names in test67
Hello,
I'm wondering if the following situation is valid (though I think it
isn't since I still cannot authenticate with ldap pass/userdb on
test67 running on FreeBSD-5.3).
Is it normal that the passdb_ldap_conn->attr_names second element (for
instance) "turns to" "homeDirectory" as the following step by step gdb
run sample shows ? :
--
Breakpoint 1,
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
2007 Aug 18
0
RSpec and acts_as_attachment
Hey guys,
I''m getting a weird error when trying to test something like the
following. It''s a model that is using acts_as_attachment but the
weird thing is the equivalent Test::Unit case passes. Does anyone
have any ideas?
Best,
Dave
# it was a Test::Unit case first
def test_should_be_invalid_without_file
UserFile.any_instance.expects(:with_image).never
2006 Dec 12
2
RXML partial question
All,
I have a RXML template which renders partial RXML templates within it.
A snippet is below. The "xml" variable is the parent template''s Builder
variable. It is passed into the partial under the name "parent_xml".
Why can''t I use :locals => {.... :xml => xml ....} in my call to render
the partial? It seems like if I do use :xml => xml, it
2005 Mar 30
2
test65 killed by SIGSEV
Hi,
I had successfully set up dovecot-1.0-test62 + ldap pass/user db, but
now I'm encoutering a SIGSEV problem with a similar set up of a brand
new dovecot-1.0-test65 installation.
The auth process is killed by a SIGSEV as reported in the error log file :
dovecot: Mar 30 17:06:59 Error: child 28291 (auth) killed with signal 11
To be precise, the problem occurs in the
2006 May 04
2
validates* give me problems
Hi All,
I''m newbie to this tool and following some tutorials I''ve came across
with this problem when configuring my webpage:
In Debian/testing, ruby1.8, rails1.1
I create my audio application which connects to a database (mysql) named
audio with tables:
articulos(id,titulo,descripcion,created_on,categoria_id) and
categorias(id,titulo)
after creating and modifying the
2005 Apr 12
1
test67 ldap_connection
Hello,
I've been trying to figure out what's wrong with authentication
against an ldap pass/user db with test67 as test62 was working fine.
[ The problem is the same as previously described in this list :
- FreeBSD-5.3
- dovecot-1.0-test67
- openldap-2.1.27
--> "ldap(dovetest,127.0.0.1): No password in reply"
--> "NO Temporary authentication failure."
or
--
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
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone explain this?
#config/initializers/ar_attributes.rb
module ActiveRecord
module AttributeMethods
alias_method :ar_read_attribute, :read_attribute
def read_attribute(attr_name)
p "read_override"
ar_read_attribute(attr_name)
end
alias_method :ar_write_attribute, :write_attribute
def write_attribute(attr_name, value)
2006 Apr 28
2
validates* gives me problems
Hi,
In Debian/testing (mysql-5.0.20, ruby1.8, rails 1.1.0)
Im trying to follow up the fourdaysonrails tutorial, and when putting:
validates_uniqueness_of :category, :message => "Already exists"
in /myapplication/app/model/category.rb
I get:
NoMethodError in Categories#create
undefined method `category'' for #<Article:0x407f6418>
RAILS_ROOT:
2006 Jan 13
1
validating without saving
i am trying to validate without saving use the valid? method on my
object. however i keep getting the following error (that i reproduced
in console) "NoMethodError for field"
Any ideas ?
thanks
adam
Loading development environment.
>> p = Post.new
=> #<Post:0x407b6050 @attributes={"created_on"=>nil, "subcat"=>1,
"cat"=>nil,
2011 Sep 17
3
[PATCH 1/1] hivexml: Base64-encode non-printable data
Some of the data in names and string values were being unsafely printed,
causing some types of XML processors to fail (e.g. Python's Expat).
This patch checks for printability of each character and outputs base64
with an encoding attribute for unsafe data.
---
xml/hivexml.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 11 deletions(-)
2005 Apr 04
0
ldap auth with test66
Hello,
The installation of 1.0-test66 (still on FreeBSD 5.3-RELEASE-p1 with
openldap-2.1.27) solved the SIGSEV problem I posted here on March 30
but I still cannot authenticate correctly with ldap.
logs report
"ldap(dovetest,127.0.0.1): No password in reply"
and my client gets a
"NO Temporary authentication failure."
Obviously the attr_names array of the
2006 Aug 09
1
Migrating a Field to External Model
I have a model Product with an attribute ''brand''. Currently it is a
simple attribute, however, I am migrating it to a separate model
Brand so that I can have other attributes with each brand. I created
the the model and created and ran the migration to create the new
table. So far so good. Then I created a separate migration to
transfer the data. The up method
2005 Dec 30
5
HABTM with finder_sql problem (Rails bug?)
I''m building an app that needs i18n support across the entire database
(i.e. localized attributes). In order to do this I''ve created a
special HABTM join table that can be associated with _any_ other
table:
create table language_strings (
for_table varchar(255) not null,
foreign_id int not null,
language_id varchar(5) not null,
attr_name varchar(255) not null,
value text