similar to: Eager loading issue

Displaying 20 results from an estimated 6000 matches similar to: "Eager loading issue"

2005 Dec 30
3
Select SUM(?) Query
When using PHP, I was able to enter a query against my list of invoices such as : Select SUM(amount) from invoices where project="123" This would give me the total amount of all invoices for project 123. In rails, how would I do this? I tried using "find_by_sql," but couldn''t figure out how to extract the results out of this. Thanks!
2006 Feb 11
6
Rails Edge, has_many :through in searches
I have two tables, a Projects table and a Clients table. It''s basically a HABTM relationship, but I have additional project/ client-specific information in the join table. I''m trying to use the new has_many :through method to join these. It works fine when displaying records, but when I try to search, I''m having this problem: When I used a HABTM model to search
2006 Jan 09
7
Large select list, speed issues
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <font size="-1"><font face="Verdana">I have a piece of code in my page to generate
2006 Jan 09
3
Custom flash[:notice]
For the most part, my flash[:notice] messages fall into one of two categories: either a message stating that something happened successfully (which is colored green), or messages showing errors (which I would like to be red). Is it possible to set some sort of flag on these messages to choose which color I want to show, or would I need to base it on CSS and set the class in the text, i.e.
2006 Mar 30
4
ActionMailer e-mails getting tagged as junk in Outlook 2003
Whenever an email is sent via ActionMailer, and the recipient is using Outlook 2003 (with SP2 installed), the e-mail is getting put in the junk e-mail folder. Since Outlook doesn''t give a reason it was tagged as junk, it''s hard to determine what to change. I''ve compared the message headers of the "junk" mail and a valid email sent through Outlook, and the
2006 Jan 22
2
File_column not keeping value during page reloads
I''m trying to use the file_column plug-in to attach a file to a newsletter posting. It works fine if I get the form right the first time, but if I get an error, such as not typing in a required field, and the form re-displays, my file selection box reverts to "no file selected." Here''s my relevant controller code: def new @newsletterpost = Newsletterpost.new
2006 Feb 03
3
Breakpointer not working
When I try to run script/breakpointer, I get the following error: /usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo'': getnameinfo: Non-recoverable failure in name resolution (SocketError) It''s Rails 1.0 on OSX 10.4.4. Any suggestions?
2006 Jan 09
6
Nil column results, possible to ignore?
For a table "clients" there are city, state, and zip fields. However, for some clients we only have a state with no actual address. The following code throws a "You have a nil object" error when outputting my client list. Is there a way around this, short of writing a specific case for each possibility? &lt;%= client.city + '', '' + client.state +
2006 Feb 28
5
Getting number of days in a month
In PHP, there was an argument you could pass to the Date function to get the number of days in the current month: echo date("t"); // Outputs "28" for February I don''t see anything like this in Ruby/Rails. Right now, I''m using a very ugly line to pull the last day of the month: @number_of_days = (Date.strptime(Date.today.strftime("%Y-%m-01"))
2006 Jan 19
2
select vs. select_tag
I have a "Users" object and a "Timesheets" object. Each timesheet entry belongs to a User, which is selected from a drop-down list. The timesheet has a user_id field. (The user needs to have an option to select a different user due to the way our system works.) If i use the "select" object, which is bound to the Timesheet model, using this code: &lt;%= select
2006 Jan 03
4
Would someone like to tell me why this code will not solve my problem? (it''s short)
I am building an invoicing system but cannot use the auto_increment field to determine the invoice number (because they are running 3 different companies off the one system. I need to find the last invoice number from any given company and then add 1 to it to get the next invoice number. BUT, there is a unique case on the very first invoice produced because there is no earlier invoice
2006 Jan 22
1
file_field questions
A couple questions about file_field elements. First, with code such as this: <%= file_field ''attachments'', ''filename'' %> Would the filename of the file I select be the value that''s stored within the database under the "filename" column, and then I would just add in code in my "create" controller to upload the actual file?
2006 May 31
1
find by sql
Hi I have the following code, which makes use of an sql statment to get the results required. However this just doesnt seem right for rails, as ive managed to develop the whole project without using any other pure sql. Is there a cleaner way of doing this, but gaining the same results. thanks scott #sql to find all invoices pSql = "SELECT DISTINCT invoices.id,
2018 Apr 10
3
Invoice numbering for customers
Just wanted to ask a quick question here. I am running GNUC 2.6.12 and when I create a invoice for a customer I have to enter an invoice number. I was thinking perhaps there is setting somewhere that I missed to get it to automatically fill in a invoice number? Id hate to have invoices with the same invoice number since I have to manually type them in right now. Thank you, jdegraw
2006 May 19
7
AR transactions and isolation levels
I''m trying to create a sequence with no gaps in my db (contrived example, but should work out the same as my real one), and believe db-managed transactions are the way to go about this. It''s my first real ''go'' at transactions, so I may be mistaken about how things really work. Anyway.. Consider this example code: Class Invoice < ActiveRecord::Base def
2010 Aug 02
5
What do you use for Invoicing?
Hi Everyone, Sorry, if it's not directly related to Asterisk. Some of people on this list might have PBX deployed for their clients. What software do you use to invoice them so the invoice looks like a proper telecom invoice maybe? Prefer: -opensource with Windows binary available. -able to create .pdf invoices rather than printable ones. Thanks -------------- next part -------------- An
2006 Jun 20
1
ActiveRecord saving madness?
Hello, First of all, I love RoR. I am studying it, and I am finally "getting there". However, I do have a bit of a problem with ActiveRecord''s saving behaviour. Imagine to have Orders (id, name) {has_one:invoice} and Invoices (id, order_id) {belongs_to :order} . If you type: invoice = Invoice.new(...whatever...) an_order.invoice = invoice if invoice fails to save, you
2006 Jan 06
3
Error Handling
Hi, I am doing a project on invoice. For that I have to use a page both for crating new invoices and for updation of existing invoices. The problem is that when an error occures, I can''t maintain the same page for error correction. How can I redirect it from the controller ? Or can I display ruby errors before submit of the page in ruby? Thanks.. Sainaba. -- Posted via
2006 Jan 03
3
What am I doing wrong!!!
Hi: @x = Invoice.find(:first) if @x do one thing else do another end This ought to work but does not. I think that @x is nil but if I test for existance or @x != nil or @x.attribute != nil - my code does not respond correctly. What is the value of @x if there are no records yet in the invoices table? Thanks in advance. bruce
2006 Jul 17
1
Updating multiple children from one page
Hello, I have a model called invoice and one called lineitem. An invoice has_many lineitems, and an lineitem belongs to an invoice. I have a model method that calculates the price of a lineitem, and one that calculates all lineitems in an invoice. I want to have an edit page that lists all the invoices lineitems and their calculated prices, with a text field for a person to change the