Displaying 20 results from an estimated 8000 matches similar to: ":prompt not working?"
2006 Jul 14
1
creating a computed column with activerecord for to_xml
Hi. I have a question about activerecord, computed columns and to_xml.
I have a simple model called person that has a first_name and a
last_name field (and thus a first_name and last_name field in the Person
table). When I :find a model and call to_xml, I would like the result
to not only send back first name and last name as xml but also add an
additional attribute called full_name that is
2006 Jan 04
5
habtm recusive
I have a people table:
CREATE TABLE people (
id int(10) unsigned NOT NULL auto_increment,
first_name varchar(75) default NULL,
middle_name varchar(75) default NULL,
last_name varchar(75) default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1272 ;
and a people_people table:
CREATE TABLE people_people (
person_id int(11) unsigned NOT NULL,
2012 Nov 03
0
ids writer fields for HABTM relationship.
Hello forum readers,
Let''s say i have two models: Person and Role (i replicated the problem
with Post & Tag as well, as i thought the problem was linked to some
application-specific rights problem, but it wasn''t).
In Person, attr_accessible role_ids is declared, so it accepts an array
of Role ids as an argument when creating / updating.
If i fire up the rails console and
2007 Nov 22
1
has_many :through questions
I''ve created the following associations using :through:
class Person < ActiveRecord::Base
has_many :attendees, :dependent => :destroy
has_many :events, :through => :attendees, :uniq => true
end
class Event < ActiveRecord::Base
has_many :attendees, :dependent => :destroy
has_many :people, :through => :attendees, :uniq => true
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2013 Jun 18
0
language specific email templates
Hi,
I am new to Asterisk. I'm using it behind a kamailio sip-router to provide voicemail boxes to sip-users.
I followed these instruction: http://www.voip-info.org/wiki/view/Realtime+Integration+Of+Asterisk+1.4+With+Kamailio+1.5.x
to set everything up, using ARA with a MySQL DB.
After a few tweaks "everything" is basically working, however, a few questions remain that I could not
2009 Apr 25
0
'get_user_list' function not working
i want to show fullname by using fuction call ''get_user_list'' , but
its not working..??
tis s user.rb
(
def full_name
self.first_name + " " + self.last_name
end )
my post controller
( def get_user_list
return User.find(:all, :order => ''last_name ASC'').collect {|user|
[user.full_name, user.id]}
NameError in
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 Mar 16
6
How to have multiple fields appear in collection_select?
I have a table of employees with the fields "last_name" and
"first_name". I would like to populate a collection select so that what
the user sees in the drop-down is "Last Name, First Name". So far, the
only way I have figured out to do this is by using "find_by_sql" in my
model, like so:
@employees.find_by_sql("SELECT id, concat(last_name,
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
2006 Jun 22
0
Active record associations
I have a table containing a person''s info:
Person
{
first_name : string
last_name : string
height : int
weight : int
age : int
}
This person can belong to many leagues and 0 or 1 teams within that
league. I can create join tables and use the following associations:
League has_and_belongs_to_many people
Team has_and_belongs_to_many people
League has one
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 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 +
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 ?",
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am 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> <%=
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
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 Mar 30
6
MS SQL query strangeness for ActiveRecord in Rails
Hi,
I am currently trying to move my rubyonrails app from Linux to Windows
server utilizing MS SQL instead of MySQL due to "business" reason. All
my listing screen utilize a drop down list in each column to allow user
to "filter" the listing based upon the value chosen from the drop down
list. In the controller, I used find() method but with customized
parameters such as
2006 Aug 11
0
SQL sort
in my list action, I setup the sort parameters as folows :
..
sort = case @params[''sort'']
when "login" then "login DESC"
when "first_name" then "first_name DESC"
when "last_name" then "last_name DESC"
end
...
to be used in a ''sort_link_helper''
2006 Jan 03
0
has_and_belongs_to_many include problem
hey,
i have users who are in groups, and i have a search form, where i can search on
group, user lastname, and user firstname.
All this is also with pagination.
these are my models
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
in my controller i do this
THIS works (but in need pagination)
@users2