Displaying 20 results from an estimated 3000 matches similar to: "Nested params and redirect_to"
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
2006 Jun 23
3
form_remote_tag is not passing form params
I''ve searched and searched and searched again, and I cannot find any
help with this problem. There''s an identical problem on this forum, but
it was never resolved. I''ll try to re-open the subject with a bit more
information.
Problem: The form_remote_tag() method in my "list" view is not passing
the params[] hash of the values stored within my form.
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
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username
and password, my setup is firstname, lastname, password.
I seemed to be gramatically challenged and not sure how to set up the
parameter list. Can anyone offer up a suggestion.
The book shows the method starting like:
if request.post?
user = User.find(:first, :conditions => [''username = ?'' ,
2007 May 30
4
aaf and dynamic attrs: a bug?
Hi!
I faced some issue while using 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
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 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 +
2006 Apr 25
14
validate_on_update with a save()
I''ve got a form with inputs like user[first_name], user[last_name], etc.
When editing the user instead of creating a new one I include a
user[id]. I then try and save the object using:
user = User.new(params[:user])
user.save()
I would *expect* that since I included the user[id] it should do an
update and should call validate_on_update. But this doesn''t appear to
be the
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) !=
user.password_hash
2012 Jul 24
4
Behavior of first_or_create
I just ran across a weird glitch (IMHO) in find_or_create. The arguments passed to it are *not* added to the conditions for the ''first'' part. This is odd, given that it''s intended to replace find_or_create_by_* methods, which *did* use the specified values as conditions.
I''m unsure on whether this behavior is entirely undesirable, but it''s definitely
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
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 error when I try, because full_name
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
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:
2007 May 16
7
bilingual site: exclude fields set from query
Hi all,
Is there a way 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
2005 Feb 05
4
Creating collections
I''m trying to create a form where a collection is created, using the
example from the Rails 0.9.5 weblog posting:
http://weblog.rubyonrails.com/archives/2005/01/26/rails-095-a-world-of-
fixes-and-tweaks/
I''m having a bit of trouble. The controller currently looks like this:
class StudentController < ApplicationController
def new
render_text @params.inspect
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 ?",
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
2006 Jan 10
15
KISS and DRY? Not even close!
Hi all,
After working on my first rails app and having handed over some very
sophisticated coding from a lot of you guys. My app does what I want it to
do, but I''m no where near the end yet, and it seems that the KISS and DRY
objectives already went down the drain.
It could be lack of knowledge, only doing Ruby on (and) Rails for a month, but
I''m stuck on the following:
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