search for: first_name

Displaying 20 results from an estimated 364 matches for "first_name".

2006 Feb 03
4
contoller code mysteries
In my controller...this code works def list2 first_name = params[:client][:first_name] @myclients = Client.find(:all, :conditions => ["first_name = :first_name", {:first_name => first_name}]) end this code doesn''t... def list2 first_name = params[:client][:first_name] if first_name searchstring = &...
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 RtransformColumnRef: select * from cli...
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 stu...
2007 May 30
4
aaf and dynamic attrs: a bug?
...it for dynamic attrs indexing/search. Maybe I made something wrong. Here is test method. Everything works just fine until last line http://pastie.caboo.se/66274 . Tested on both stable and trunk of aaf and ferret 0.11.4. the short version of code below: Contact.acts_as_ferret :fields => [ :first_name ] assert Contact.find(:first).respond_to?(:first_name_to_ferret) assert_equal 1, Contact.find_by_contents(''Y*'').total_hits assert_equal 1, Contact.find_by_contents(''first_name:Y*'').total_hits Contact.aaf_index.close FileUtils.rm_rf ''inde...
2006 Aug 07
8
Login form question
...book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' , params[:username]]) So here is my attempt but with some obvious mistakes: def login if request.post? user = User.find(:first, :conditions => [''first_name = ?'', ''last_name = ?'', params [:first_name], [last_name] ..... end TIA Stuart
2006 Aug 07
3
wrong number of bind variables
I''m getting this error message since i moved alot of the database logic to the model. wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password + user.password_salt) != user.password_hash raise &qu...
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 code <%= text_field_with_auto_complete :user, :last_name %> where do I concatinate first_name and last_name to make a name? thanks...
2006 Aug 07
2
Bind variables error
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? I''m not sure why I"m getting this error ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password +...
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 whic...
2012 Jul 24
4
Behavior of first_or_create
...r_create_exactly, perhaps?) that uses the supplied attributes as additional conditions. If nothing else, the documentation should be updated to reflect this scenario - the last case in the examples *almost* describes this scenario, but the block form used there makes it unclear what: User.where(:first_name => ''Scarlett'').first_or_create(:last_name => "O''Hara") would do. I also found that DataMapper implements the behavior I was expecting in their first_or_create method: https://github.com/datamapper/dm-core/blob/master/lib/dm-core/model.rb#L448 Thoughts...
2006 Jan 19
2
Simple Ferret Questions
I am trying to use Ferret for searching for users based on first and last name. In my index, I am adding the first_name, last_name, and a full_name which is basically "#{first_name} #{last_name}". I am searching the index using something like the following query: INDEX.search_each(%Q/first_name:#{query}* OR last_name:#{query}* OR full_name:#{query}*/) do |doc, score| The problem I am having is when I se...
2006 Jun 19
6
SQL Search Qustion
I am working on writing a search method where a user can type a string of words and I return all the objects that have fields that match all of the words in one or a combination of fields. Person first_name last_name Pet name Person has_many :pets I want to write some SQL so that if I search for "Tony AAAA" I will get all the people who have Tony and AAA either in their first_name or last_name fields or in any of their pet''s name fields. For example, it would be ok to ret...
2007 Nov 06
2
Why is this view spec failing?
...m getting a failure. It renders out fine in the browser. <h1>New member</h1> <%= error_messages_for :member %> <% form_for(:member, :url => members_path) do |f| %> <fieldset> <legend>Member Info</legend> <p><label for="member[first_name]">First Name:</label> <%= f.text_field :first_name %></p> <p><label for="member[last_name]">Last Name:</label> <%= f.text_field :last_name %></p> </fieldset> <p> <%= submit_tag "Create" %>...
2010 Oct 05
2
Is it possible to query on virtual attributes?
I have a Person model with attributes first_name and last_name. I want to implement autocomplete search that looks that the entire name. Hence I have a method: def full_name self.first_name + " " + self.last_name end Is it possible for me to query on full_name and have rails match the first_name and last_name fields? I currently...
2006 Feb 02
12
basic ''find'' question
I am struggling to understand the methodology here... I have a find.rhtml <%= start_form_tag :action => ''list2'', :first_name = client %> <%# render :partial => ''form'' %> <p><label for="client_first_name">First name</label><br/> <%= text_field ''client'', ''first_name'' %></p> <%= submit_tag ''F...
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...
2006 Feb 07
3
Newbie help ..
...ed. -m. $cat app/views/admin/new.rhtml <% @page_title = "New member..." -%> <%= start_form_tag( :action => ''create'' ) %> <table> <tr> <td> First Name: </td> <td> <%= text_field( "member", "first_name", size => 40 %> </td> </tr> <tr> <td> Last Name: </td> <td> <%= text_field( "member", "last_name", size => 40 %> </td> </tr> <tr> <td> </td> <td> <%= su...
2007 Aug 26
2
Multi-word query searching across columns
I''m trying to implement a basic name search on a People table with separate first_name and last_name columns. I am using the will_paginate plugin and have the following search method in the model: def self.search(search, page) paginate :page => page, :conditions => ["lower(last_name) like ? or lower(first_name) like ?", "%#{search.downca...
2006 Mar 20
2
AHHHhhhhh... has_and_belongs_to_many, that is going on?
...many configuration looks as follows. And, these errors while running some simple test with ./script/console is giving me a headache: ./script/console Loading development environment. >> r = Reviewer.find_first => #<Reviewer:0x19d0a48 @attributes={"id"=>"1", "first_name"=>"Big", "last_name"=>"Bird"}> >> r.candidates => [#<Candidate:0x19c6340 @attributes={"status"=>"", "id"=>"1", "sponsor"=>"", "first_name"=>"Jim", &quo...
2006 Feb 21
8
Validations continued
...:client]) if @client.save! flash[:notice] = ''Client was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end end Model # includes the following validates_presence_of :first_name protected def validate errors.add_on_empty %w(first_name) end And if I try to enter a new ''client'' missing the first name, it sends me to trace error page but doesn''t capture it as it suggests in Agile book. This is making me crazy and is a continuation of my...