search for: last_name

Displaying 20 results from an estimated 295 matches for "last_name".

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...
2006 Aug 07
8
Login form question
...nditions => [''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 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 appropriate...
2007 May 30
4
aaf and dynamic attrs: a bug?
...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 ''index'' Contact.acts_as_ferret :fields => [ :first_name, :last_name ] assert Contact.find(:first).respond_to?(:last_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 assert_equal 1, Contact.find_by_contents(''last_na...
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 "Username or pas...
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 + user.password_salt...
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 need to use thi...
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 search the in...
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 receive this e...
2012 Jul 24
4
Behavior of first_or_create
...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? --Matt Jones -- You received this message because you are...
2006 Feb 26
3
simplify
...e 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 and simpl...
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 return a person...
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.downcase}%", &q...
2006 Jul 06
4
Oracle HR on Rails
Interesting read...apologies if it has been posted already. http://www.oracle.com/technology/pub/articles/saternos-rails.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060706/619e650a/attachment.html
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes (first_name, last_name and email) I also have a select drop_down to choose a role from an array first_name, last_name and email are user record attributes, but I defined the role name as a virtual attribute validates_presence_of :email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if...
2005 Feb 05
4
Creating collections
...reate end end And the view: <form action="new" method="post"> <% (1..3).each do |i| %> <p> First Name: <%= text_field "student[]", "first_name" %> <br /> Last Name: <%= text_field "student[]", "last_name" %> </p> <% end %> <input type="submit"> </form> The idea is to have a form where I can enter information for three different students at the same time, and somehow create them all at once. Unfortunately, all of the first_name and last_name text fields...
2010 Apr 20
5
Smart localisation
Hi, I have some trouble using Il8n. I''ve had these problems for a while now and always used rough workarounds, but as my productivity needs to go up another notch, I was wondering whether there was any way of avoiding these workarounds. For example: When I''m inside a view (say ''home/index'') and use t(''title''), I''d like Rails to know
2007 May 16
7
bilingual site: exclude fields set from query
...to have searches no use some indexed fields, when processing a query? context: I have a model Foo that holds some information in two languages : - text1_nl, text2_nl, text3_nl and - text1_en, text2_en, text3_en Some other fields are common to both languages and indexed as well - first_name, last_name Depending on the visitor language choice I need to exclude the first three, or last three fields when query processing. Is this doable relatively simply? I guess I could use two indexes, but I''d like to keep using acts_as_ferret if possible. TIA. Alain Ravet -------- http://blog.ravet...
2012 May 21
4
Getting model column names
Hello, I am writing a RoR application that connects to a couchDB database using couchrest_model. The definition of my model is the following one: class BdsDataAuthor < CouchRest::Model::Base property :id, Integer property :first_name, String property :last_name, String end I would like to be able to get the list of the model columns, e.g., the result of BdsDataAuthor.columns would be [id, first_name, last_name] Is it possible? I saw that active_record provides this kind of method (column_names), but since I am not using active_record... A solution tha...
2006 Mar 14
2
noob question about find()??
could anyone tell me why this doesn''t work??? <%= select(:schedule, :employee_name, Employee.find(:all, :order => ''last_name ASC'').collect {|p| [p.first_name, p.last_name] }, { :include_blank => ''true'' }) %></p> i mean it works half way, only the first name is displayed.. i''ve been at it for a while now.. the answer is probably right in front of my face.... -- Posted...