similar to: Newbie: using find like a sql join query

Displaying 20 results from an estimated 200 matches similar to: "Newbie: using find like a sql join query"

2006 Apr 06
6
pagination question
i''ve figured out how to use the next and previous links with the paginator class but now i''m trying to figure out how to display all the page numbers in between. looking through the rails api, i found paginator.each() but i''m not sure how to use it, or if that''s even what i am looking for. also, is there a way to limit the amount of pages like some sites
2005 Dec 21
3
How to make a drop-down automatically submit an AJAX form
Hi, I know that to make a dropdown box automatically submit when you change the value, you do this: <select ..... onchange="this.form.submit();"> BUT i''ve got an ajax form, and if i do the above trick, it simply reloads the ajax partial into the whole screen, rather than into the div where it is meant to go. I''ve already got it all working so that if you click
2006 Mar 22
0
Another Problem with params
I am trying to do a similar thing for some spares that I am trying to manage... My spare.rb file is as under class Spare < ActiveRecord::Base belongs_to :department, :class_name => ''department'', :foreign_key => ''department_id'' belongs_to :subequipment, class_name => ''subequipment'', :foreign_key =>
2006 Jul 12
0
Lookup Field ??
Hi, I am new to Rails. And I wonder how to define lookup fields for a table... Suppose we have an employee table and a departmant table... Each employee record have a department_id field... And when listing employees, we want to show the user friendly department_name from department table.. How can I do this? Thanks .... Bu e-posta mesaji, mesajin alici kisminda belirtilmis
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to, habtm, and the new has_many => :through relationships. Whenever I try a find(:all, :conditions => "some conds", :include [:relationship]) it works fine, but if I have find(:all, :conditions => "some conds", :include [:relationship, :other_relation]) it gets a sql error such as Mysql::Error: You
2014 Dec 03
3
partedmagic connecting to a comcast address
On 12/03/2014 04:15 PM, zep wrote: > >>> oh. the ARP packet suggests that MAC address is 192.168.1.144 >> that is how i see it. >> > is that 1.144 IP address in use by the machine you ran the lspci > from? somewhere. but i know not where. http://www.whoami.it/home/ shows me to be; adsl-184-41-28-86.mem.bellsouth.net for the hell of it, i pulled and
2014 Dec 03
3
partedmagic connecting to a comcast address
John, thank you for replying. On 12/03/2014 03:21 PM, John R Pierce wrote: > On 12/3/2014 12:47 PM, g wrote: >> wireshark text file loaded at; >> >> http://pastebin.com/rCU0CC10 > > some device on your network has the MAC address 00:0f:fe:8f:8f:23 > which Wireshark is calling PartedMagic for unknown reasons. see my new paste at; http://pastebin.com/8vBxnUSf
2006 Nov 08
4
writing SQL query WHERE.. IN.. anArray ?
I have an array @dpt_ids ex : @dpt_ids = ["43", "48", "49", "50", "51"] I try to insert it into my sql query to be used in a ''find_by_sql'' query = "SELECT * , #{kms} AS km FROM cities" query << " WHERE department_id IN ( #{dpt_ids} ) " but this transform my array into a unique string :
2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign key? The problem is, I can''t check if the attribute is a valid foreign key if the attribute doesn''t even exist. For example, every employee must be in a department. In the following code, if an employee''s department_id is not present then Department.find_by_id(department_id) might cause
2006 Mar 13
3
validates_associated problem
Hello, I have a situation where an ''employee'' belongs to a ''department'' and have setup the relationship as follows. class Employee < ActiveRecord::Base belongs_to :department, :foregin_key => "department_id" validates_associated :department_id end class Department < ActiveRecord::Base has_many :employees def validate_on_update
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
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
2006 Feb 23
4
MySQL Duplicate Key Error
I am a newbie and I am running into a problem which I cant understand. I have a table called ''privileges'' which has the following fields CREATE TABLE `sdqualplanner`.`privileges` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(20) NOT NULL default '''', `description` varchar(100) NOT NULL default '''', `section_id`
2012 May 07
1
Complex sorting question, or not?
I have a function that displays all depts and related info from other tables in my Department model, such as: def dept_and_hospital "#{name} (#{floor.building.hospital.name})" end ... which is used in my view, like: <p> <%= f.label :department_id %><br /> <%= collection_select(:device, :department_id, Department.all(), :id, :dept_and_hospital,
2006 Mar 30
3
Model.find(:all) where Model.association has more then 0 items?
Hi everyone, I have a Department model that has_many people. How do I go about finding all departments with more than 0 people? Department.find(:all, :conditions => Department.people.size > 0) That, of course, doesn''t work, but it was as close as I could come. Thanks! Sean
2006 Mar 13
7
Problem with params
I''ve got a User model, which holds the following (excerpt): def try_to_authenticate User.authenticate(self.username, self.password) end .. private def self.hash_password(password) Digest::SHA1.hexdigest(password) end def self.authenticate(username, password) @user = User.find(:all, :conditions => ["username = ? AND password = ?",
2006 May 06
0
RE: Rails Digest, Vol 20, Issue 156
I am looking for a ruby hosting service. Can any one recommend one for me. -----Original Message----- From: rails-request@lists.rubyonrails.org [mailto:rails-request@lists.rubyonrails.org] Sent: Saturday, May 06, 2006 7:37 AM To: rails@lists.rubyonrails.org Subject: Rails Digest, Vol 20, Issue 156 Send Rails mailing list submissions to rails@lists.rubyonrails.org To subscribe or
2006 Apr 26
2
two layers of has_many
Hi, There are many companies. Each company has many departments. Each department has many employees. The following find_by_sql method seems awful. What is the best way to get all the employees of a company? class Company < ActiveRecord::Base has_many :departments def employees Employee.find_by_sql("SELECT employees.* FROM companies, departments, employees
2009 Aug 26
7
storeconfigs + environments issue
Hi Guys, Im trying to turn on storeconfigs with a mysql db backend. On my testing server in our lab, i configured this successfully and can see if keeping information on all test hosts. When trying to implent the same idea onto our production puppet server, I get the following errors: Aug 26 16:35:53 opsynxsr0097 puppetmasterd[27003]: (/Settings[/etc/
2009 Aug 02
3
Intel vs ATI – which one is better for wine?
Hello everyone, as stated in the topic ? I would like to know which of above works better with wine... I will be buying laptop soon, and will probably have to chose one of above. Yes I know both Intel and ATI drivers for Linux sucks ? but I would like to know which of them sucks more ;], Nvidia will probably not be an option because of my current cash limitation (beside, I already got pretty