Displaying 11 results from an estimated 11 matches for "find_all_by_name".
2006 Apr 20
7
Rails + postgres case insensitive searches.
Hello all
I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name("tim") in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
2008 Jul 08
3
undefined method `name' ...........
...Lens ''Ruby on Rails'' book.
(This is written for ror 1.x - and I''m using NetBeans 6.1 - ror 2.x -
this might be the problem...)
But...
I have made this Controller:
class StoryController < ApplicationController
def index
@current_time = Time.now
@s = Story.find_all_by_name(''sitepoint'')
end
end
and this view:
<h1>Story#index</h1>
hej
<%= @current_time %>
<%= @s.name%>
<p>Find me in app/views/story/index.html.erb</p>
And, when browsing my ''story'' (http://localhost:3000/story), I get
this error...
2007 Feb 13
1
observe_field and select box
...39;},
:update =>"test_person",
:loading => "Element.show(''indicator'')",
:complete => "Element.hide(''indicator'')",
:with => "test_company}) %>
If i use
<%= select(:test, :company
,Company.find_all_by_name(test.company.to_s).map{|c| [c.external_id,
c.name]})%>
for my first select box then the observe field works ... but i cannot
insert the "Create New" option.
What am I doing wrong?! Any help it would appreciated.
Thank you,
Sincerely,
--
Posted via http://www.ruby-forum.com/.
--~-...
2007 Jun 13
6
ActiveRecord query using association
Hello all,
I apologize if the answer to this question is going to be rudimentary,
but I am thus far stymied by the information I have found on the web.
This seems like it should be simple, but I haven''t really found an
example of how to do this yet.
I have a model called Account which has a belongs_to reference to
another model, User, as below:
class Account < ActiveRecord::Base
2006 Jul 31
2
updating records in a many-to-many relationship
Im trying to establish relationships in a many to many table.
When I create a user, I do this to insert the different relationships
between the user and sports:
c.sports<<Sport.find_all_by_name(params[:sports])
where c is the user. The problem is, when I edit this user, and lets say
he adds a sport, I can''t use this because I get an error saying that
some records already exist since its not only adding the new records but
also all the old records again.
What is the best way...
2006 Sep 09
1
options_from_collection_for_select
I''ve looked at the API on this but can''t quite see what I''m missing from my call
<select id="pay[pay_id] name="pay[pay_id]">
<%= options_from_collection_for_select(
Pay.find_all_by_name, "id", "name") %> #<- line 5
</select>
is returning -
Showing app/views/kr/index.rhtml where line #5 raised:
wrong number of bind variables (0 for 1) in: pays.`name` IS ?
Anyone ?
TIA
Stuart
--~--~---------~--~----~------------~-------~--~----~
You received thi...
2006 Jul 29
1
creating and storing records in Ruby
...easy, and practical application for RoR. If you
guys know of any resources on the net to answer these questions let me
know.
Question 1:
Basically, I have a many-to-many relationship that I want to add records
to. I use something like this to add records in the A_B table:
c.clubs<<Club.find_all_by_name(params[:clubs])
This takes the ones that already exist and establishes a relationship
between A and B.
What if I want to take ones that don''t exist in params[:clubs] and have
those added to Club table? Is there any shortcut operator for doing that
AND also does the << operation...
2006 May 25
0
uninitialized constant
...timeError
attr :places
def initialize(places)
@places = places
end
end
------
Search
------
require ''ambiguous_place_exception''
class Search < ActiveRecord::Base
def self.search_by_category_and_place(category, place)
# Find places by name
places = Place.find_all_by_name(place)
if places.size > 1
e = AmbiguousPlaceException.new (places)
raise e
end
...truncated...
end
end
--
Posted via http://www.ruby-forum.com/.
2006 Oct 23
10
text_field_with_auto_complete
Hi,all
I''ve used text_field_with_auto_complete for a while but still haven''t
figured out how to store the value that I selected from the suggested
options. any hints?
Thanks!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2008 May 22
9
Retrieving Mutliple Records using find_by_*
I was hoping that AR''s find_by_* magic methods would help me retrieve
multiple items somewhat like the following:
names_to_find = [''Larry'', ''Moe'', ''Curly'']
found_people = Person.find_by_name(names_to_find)
Is there a way to accomplish this using find_by_* (or even find(:all)
using some sort of conditions) or must I resort to SQL
2007 Sep 17
8
DISTINCT?
This should be easy, but I''m stumped...
class X < ActiveRecord::Base
belongs_to :y
end
class Y < ActiveRecord::Base
has_many :x
end
The y table has a column names. The x table has a column value. I
want the list of values in x for the name "Location" in y. Yes, there
are many repetitions.
I can probably hack together an SQL statement to do this without too
much