Displaying 14 results from an estimated 14 matches for "middle_initial".
2006 Jan 25
7
join fields for list views
I am sitting with the Agile book on my desk and scratching my head at
the discussion on aggregation - perhaps that isn''t what I need.
I have a db called clients.
fields include - first_name middle_initial last_name
I want to combine them all into one name element in a list view. I can
add/edit the fields separately but in the list view, I only want the one
combo field.
Is there a documentation page that describes this? I have browsed the
rubyonrails.org wiki and haven''t stumbled into an a...
2006 Jul 22
3
refactoring commonly used aggregations
I have a number of models that use an aggregation to combine First Name,
Middle Initial and Last Name and they have been working fine. I am
looking to clean this up, DRY it if possible.
I have things like this in application.rb
class Clwholename
attr_reader :first_name, :middle_initial, :last_name
def initialize(first_name, middle_initial, last_name)
@first_name = first_name
@middle_initial = middle_initial
@last_name = last_name
end
def to_s
[ @first_name, @middle_initial, @last_name ].compact.join(" ")
end
end
and then in whichever model I nee...
2006 Feb 26
3
simplify
Trying to use Eric''s help and Amy Hoy''s page of playing with
auto_complete and decided that the script/console is the place to
rapidly test.
I have this feeling that CONCAT isn''t working for postgresql...
c = find_by_sql(SELECT * FROM clients WHERE CONCAT
(first_name,middle_initial,last_name) = "johnadams")
^
(irb):61: syntax error
c = find_by_sql(SELECT * FROM clients WHERE CONCAT
(first_name,middle_initial,last_name) = "johnadams")
^
from (irb):61
As you can tell...I''ve taken a number of stabs at it...
2006 Feb 27
2
Ajax - from there to here
...omplicated but I will simplify as best I can.
My view code is simple...
<%= text_field_with_auto_complete ''client'', ''wholename'' %>
# wholename is not a column in ''clients'' but rather represents an
aggregation of 3 fields...first_name, middle_initial, last_name
my controller code does the necessary part to display the
''auto_complete'' listing...
def auto_complete_for_client_wholename
@clients = Client.find(:all,
:conditions => ["LOWER(first_name||middle_initial||last_name)
LIKE ?",
'...
2006 Jan 20
3
postgres db setup
...record-1.13.2/lib/active_record/connection_adapters/postgresql_adapter.rb:137:in `execute''
*** there''s more but I didn''t think I needed to ***
Postgres setup...
CREATE TABLE clients (
id serial primary key NOT NULL,
first_name character varying(25) NOT NULL,
middle_initial character varying(1) NOT NULL,
last_name character varying(25) NOT NULL,
gov_id character varying(18) NOT NULL,
dob date
);
MySQL setup
CREATE TABLE `clients` (
`id` int(8) NOT NULL auto_increment,
`first_name` varchar(25) NOT NULL default '''',
`middle_initial` c...
2006 May 17
5
text_field_with_auto_complete (newbie question)
I have the text_field_with_auto_complete woking on my user DB using
last_name. so looking for ''ivanoff'' works great, but I can''t find
''john''. Plus I like to have ''last_name, first_name'' show up in the
dropdown.
what I can''t figure out is how to concat first_name and last_name to
make a name and use that to look it.
working
2006 Feb 03
9
Because I''m very slow - trying to use console
I can''t see how to use variables so I am using console to test things
out...
clients table - a column named first_name
My very brief console session...
>> clients = Client.find_by_sql("select * from clients where first_name
= FN")
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703 Mcolumn
"fn" does not exist Fparse_expr.c L1034
2006 Feb 26
2
auto_complete on steroids
I am trying to get more out of auto_complete than it apparently was
designed to deliver.
My problems seem to be two fold.
1 - I use aggregations on
names... :first_name, :middle_initial, :last_name and then aggregate
them using a composed_of :wholename thing
auto_complete_for seems to be wired to only use table columns directly
and gags on the aggregate form.
2 - foreign table columns - auto_complete_for seems to be unusable for
obtaining matching values from a column in another...
2006 Apr 26
5
Best way to split forms into steps?
I have a form with about 30+ fields, which the client is wanting to
separate into 3 pages/steps - just wondering what is the best way to go
about this, specifically remembering data entered, from one page to
another, and making sure the various bits of data are validated
correclty, error messages outputted etc etc...
is there a best practice method for doing this?
--
Posted via
2006 Feb 08
6
can''t get date_select to work
Hi,
I render a couple of date_select fields, the HTML looks fine, I can
see the values submitted back to the server, but AR doesn''t pick them
up from the hash in Booking.new(params[''booking'']).
I''ve got a ''booking'' object with parameters product, startdate and
enddate.
HTML snippets:
<select
2006 Feb 21
8
Validations continued
I simply can''t figure this out. I have been reading and re-reading Agile
book and wiki.rubyonrails.org - all sorts of validation methods and
still, it doesn''t work.
Controller code
def create
@client = Client.new(params[:client])
if @client.save!
flash[:notice] = ''Client was successfully created.''
redirect_to :action =>
2006 Mar 12
0
undefined method and auto_complete
...olename, {} %>
</p>
</td>
new, which throws me an error...
undefined method `clwholename'' for #<Placement:0xb78e0dc0>
which has the same exact view code as above...
clwholename is an aggregation defined in the Client class which combines
the client first_name, middle_initial, last_name
the controller code for new and find don''t seem to impact this...
def find
@placements = Placement.find(:all)
@clients = Client.find(:all)
end
def new
@placement = Placement.new
@client = Client.find(:all)
end
but just to make sure, I added the 2 line...
2006 Mar 04
6
validation of aggregates
This may not be possible...
I have an aggregation of clwholename defined in my model.
the aggregation builds clwholename from :first_name, middle_initial,
last_name
and it generally works fine.
I am trying to add a validation so while there may be many ''John''
first_names, and ''Doe'' last_names, I only want one ''John Doe''
so I tried...
validates_uniqueness_of :clwholename
and I get an error wh...
2006 Jan 25
17
Lookup pattern in Ruby
Hi folks,
I''m curious how a lookup with a large group of values would be handled
in Rails.
For example, I have a (contrived) AnimalType filtering a list of many
Animals--more than can be presented comfortably in a dropdown box.
Therefore I need to either redirect to another screen to select an
animal (returning after the selection is made), or show a dialog--modal
or otherwise--to