Displaying 20 results from an estimated 400 matches similar to: "Validation with Aggregation"
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 Jul 27
9
Introspecting validates_presence_of
Hello people,
I''d like to detect whether an attribute of a model has
vaildates_presence_of applied to it so I can automatically apply a
mandatory (*) to the field...it doesn''t look easy...any ideas?
Cheers,
--
Dan Webb
http://www.danwebb.net
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
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec
for a few weeks. I found that for my controller specs, my setup
methods were getting very long building mocks/stubs for all the model
objects I needed to work with.
I''ve started creating helpers like the following for each of my
models. The "min_" methods are short for "minimum", and
2016 Mar 26
2
DW_TAG_member extends beyond the bounds error on Linux
Hi,
While dogfooding our lldb based IDE on Linux, I am seeing a lot of variable
evaluation errors related to DW_TAG_member which prevents us from release
the IDE. Can anyone help to confirm if they are known issues? If not, any
information you need to troubleshoot this issue?
Here is one example:
(lldb) fr v
*error: biggrep_master_server_async 0x10b9a91a: DW_TAG_member '_M_pod_data'
2016 Mar 27
0
DW_TAG_member extends beyond the bounds error on Linux
If you're going to use clang built binaries with lldb, you'll want to pass
-fstandalone-debug - this is the default on platforms where lldb is the
primary debugger (Darwin and freebsd)
Not sure if that is the problem you are seeing, but will be a problem
sooner or later
On Mar 26, 2016 4:16 PM, "Jeffrey Tan via llvm-dev" <llvm-dev at lists.llvm.org>
wrote:
> Hi,
>
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi,
in the past few months someone posted an entry on their blog about
how to do validations in non-AR classes and I cant find it any more.
Anyone have a link?
Thanks,
Trevor
--
Trevor Squires
http://somethinglearned.com
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 Mar 19
4
Trouble with composed_of
I''m trying to use composed_of within my model. I have a field in my
database named ''card1'', which is simply a string. I have this in my
model
class Player < ActiveRecord::Base
composed_of :card1, :class_name => ''Card''
end
class Card
attr_reader :value, :suit
def initialize(s)
@value = s[0].chr
@suit = s[1].chr
end
end
The
2006 Feb 28
12
Examples for Money library ?
Can anybody share some examples of their Money implementation ?
I''m trying to setup a Model to use this library, but can''t seem to wrap my
head around how it is exactly supposed to work.
My Model (Foo) looks like:
===============
composed_of :commission, :class_name => "Money", :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in
2007 Mar 29
1
ActiveRecord attributes -- strange behavior when adding Array to an element
Hi,
I have a database table and associated ActiveRecord model. I was
trying to store (temporarily) an array in one of the attribute
elements - not to save it, but just so that I can keep some form data
in a sensible place. A stripped down version of the problem I''m having
is:
p = Property.new(:bedroom_count => ["2","3"])
puts p.inspect # ==> will correctly show
2007 Apr 27
3
attachment_fu content_type problem
Hi all....
Admittedly I''m new to Rails and trying to find my way but I''m having
an issue with uploading documents with attachment_fu.
I have a form where I''m uploading multiple attachments (using AJAX to
add file_filed_tags). That seems to work pretty well. The problem is
I can''t seem to get the content_type to work as I would expect. For
example, if I use
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,
2016 Mar 27
1
DW_TAG_member extends beyond the bounds error on Linux
Thanks David. I meant to send to lldb maillist, but glad to hear response
here.
Our binary is built from gcc:
String dump of section '.comment':
[ 1] GCC: (GNU) 4.9.x-google 20150123 (prerelease)
Is there any similar flags we should use? By doing "strings -a [binary] |
grep -i gcc", I found the following flags being used:
GNU C++ 4.9.x-google 20150123 (prerelease)
2006 Apr 17
5
Finding out updated fields
Hi,
When we update a record via an update form, is there an easy way to find
out the fields that have been changed. If the update is successful, i
want to display:
The following fields have been changed:
field-name = new-value
...
Thanks,
Lantis.
--
Posted via http://www.ruby-forum.com/.
2005 Dec 19
2
Advanced search/filter use cases
I''ve been working on an application lately that has a lot of advanced
search and filtering functionality (with ranges and substring searches
for each attribute). Despite being a pretty common use case, this isn''t
supported particularly well by any framework I''ve used, including Rails.
I''d like to fix that. :)
Right now, my major pet peeves are:
1. Long,
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in
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(-)
2009 Sep 28
6
What is the most efficient way to split a table into 2 groups?
I have the following:
@lot = Lot.find(params[:id])
part_nums = Part.all(:conditions => ["id <> ?", @lot.part.id])
I guess I should mention that
Lot :belongs_to => :part
I was looking at the log following the execution of these two
statements and I saw something like this:
Lot Load (0.4ms) SELECT * FROM "lots" WHERE ("lots"."id" = 13)
Part
2005 Dec 17
1
How to use validation with aggregation (composed_of)?
At the risk of being banned for posting the same question twice, I
thought I''d try once more with a question for the title rather than a
statement (on the basis that perhaps questions get answered and
statements ignored ;-) )
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