Ooh - I'm pretty new to hobo, but I just solved this problem (visual
identification by uniquely naming something where no individual field
is unique)...
There is a "name" attribute for fields, so you can pick one field as
the name to be used (there's also rules for picking fields called
"name", "title", etc, by default):
fields do
first, :string, :name => true
second, :string
...
You can't pick two or more fields like this - you get only one field
treated as the name. Try this instead:
def name
"#{name}, #{address1}, #{city}, #{state}"
end
The method "name" will be used to calculate the value to show in
Forms, Cards and Pages. Works a treat for me. :)
I think this is the first answer I've given on this list, rather than
yet another newbie question. Feel my smugnitude (yes, I think this is
actually the right answer).
Cheers, JeremyC.
> From: Arthur Baldwin <
eengn...@yahoo.com>
> To: "
hobo...@googlegroups.com" <
hobo...@googlegroups.com>
> Sent: Monday, January 16, 2012 1:11 PM
> Subject: Re: [Hobo Users] Re: Multi - Field Uniqueness
>
> Ok, I got it working! I had forgotten to include a colon in front of the field names between the opening and closing brackets.
>
> Arthur
>
> ________________________________
> From: Arthur Baldwin <
eengn...@yahoo.com>
> To: "
hobo...@googlegroups.com" <
hobo...@googlegroups.com>
> Sent: Monday, January 16, 2012 12:24 PM
> Subject: Re: [Hobo Users] Re: Multi - Field Uniqueness
>
> What do you mean when you say "fall back to the rails validation"? Do I need to make changes to a different file than the conact.rb file in the models directory?
>
> Arthur
>
> ________________________________
> From: kevinpfromnm <
kevinpfro...@gmail.com>
> To:
hobo...@googlegroups.com
> Cc: Arthur Baldwin <
eengn...@yahoo.com>
> Sent: Monday, January 16, 2012 12:03 PMco
> Subject: [Hobo Users] Re: Multi - Field Uniqueness
>
> you'll need to fall back to the rails validation (which the hobo is a rails validation, just a shortcut for a common use case).
>
> IIRC, the syntax is like validates_uniqueness_of :field, :scope => [:other_field1,...]
>
> If that's not enough to get you going, you can get to the rails docs pretty easy with a quick google search on validates_uniquess_of (should autocomplete after the u)
> --
> You received this message because you are subscribed to the Google Groups "Hobo Users" group.
> To view this discussion on the web visithttps://
groups.google.com/d/msg/hobousers/-/VvjxOt3xpyAJ.
> For more options, visit this group athttp://
groups.google.com/group/hobousers?hl=en.
> For more options, visit this group athttp://
groups.google.com/group/hobousers?hl=en.