Displaying 5 results from an estimated 5 matches for "find_all_by_id".
Did you mean:
find_all_by_
2008 May 16
3
has_one and find_by_id issue
I have two models:
testamonial
photo (has_attachement)
testamonial has_one photo
The issue is when do this:
@testamonial = Testamonial.find_all_by_id(id)
I get "undefined method `photo'' for" in my browser?? BUT here is the
big kicker....
If I do @testamonial = Testamonial.find(:first)
everything works fine and the image is show!.. (find :all works too
when I loop through the objects.)
I tried @testamonial = Testamonial...
2006 Apr 05
4
How to do IN(?) query?
I''m trying to do an IN query, where I have an array of user objects
imaginatively named ''users'':
:conditions=>["user_id IN (?)", users.collect{|u| u.id }.join('','')]
this ends up with:
... IN(''1,2,3'') ...
Obviously I want this to be:
... IN(1,2,3) ...
or even
... IN(''1'', ''2'',
2008 Jun 06
1
STI vs Polymorphism
...me thinking.
Is it wrong to do
class Communication < ActiveRecord:Base
end
class Message < Communication
end
class Question < Communication
end
class Answer < Communication
end
etc.
This way I could keep everything in one table but then I can''t do easy
things like Answer.find_all_by_id(5)
I think I am missing something about the behaviors here and would love
some help.
Thanks
Kent
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&q...
2006 Apr 26
6
get foreign key table data
Hi
I?m trying to bring across all related data.
My table clients has a foreign key field that stores the id of an
organization
How can I grab the details of the organization to use in the clients
show.rhtml file?
Thanks
Scott
--
Posted via http://www.ruby-forum.com/.
2008 Jan 22
9
Cannot connect when spawning new workers on demand
...ulti com/indexController#uitvoeren
Not able to connect
Here''s the code that spawns the workers: (sorry for the linewraps)
def uitvoeren
# put selected servers in a session
session[:selectedservers] = params[:servers]
session[:running_cmd] = 1
@selected_servers = System.find_all_by_id(params[:servers])
@selected_servers.each do |svr|
# spawn new process
MiddleMan.new_worker(:worker => :remote_command_worker, :job_key
=> svr.name)
MiddleMan.ask_work(:worker => :remote_command_worker, :job_key =>
svr.name, :worker_method => :do_work, :data =>...