Displaying 20 results from an estimated 2000 matches similar to: "generating unique tracking numbers"
2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting
to write a method that will get key value from a sequence table and then
update it and return a value. I''m hoping to put this in the base
ActiveRecord method so I would like to reference the table name with
self.table_name or something...
class Contacts < ActiveRecord::Base
set_table_name
2005 Dec 30
9
SELECT MAX
How does one do a SELECT MAX query in rails? I''ve searched and searched and
tried lots of things with no luck.
I want to implement "SELECT MAX(column_name) from table_name
and have it return the maximum value from column_name. I just need to get
that one value, not the whole object...
Thanks for any ideas...
Shelby
_______________________________________________
Rails mailing
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi,
Is there an easy way of querying an active record for a maximum column
value? I need to do queries like:
SELECT MAX(salary) FROM employees
TIA,
Jeroen
2006 Jan 07
8
Using find_by_sql to get the sum of a column
Hello,
I was wondering if there was a method in Rails that returns the sum of a
column. For example, I have a column called ''score'' and writing a SQL
statement such a ''select sum(score) from table_name'' does return the sum
of the values in the column. In the past (not too long ago being a
newbie), I defined all sorts of methods only to discover that Rails
2014 Apr 11
2
[LLVMdev] llvm cse optimization
I'm working on the across the subprogram call optimization, and let's say the following llvm IR,
@ng0 = internal global [2 x i32] [i32 2, i32 0], align 4
%t7 = alloca [16 x i8], align 16
%add.ptr = getelementptr inbounds i8* %t1, i64 40
%call = call i8* @handle_value(i8* %add.ptr, i32 3) #3
%arraydecay = getelementptr inbounds [8 x i8]* %t3, i64 0, i64 0
%arraydecay1 =
2013 Aug 12
1
[PATCH v2 1/7] Intel MIC Host Driver for X100 family.
On Wed, Aug 07, 2013 at 08:04:07PM -0700, Sudeep Dutt wrote:
> +/**
> + * struct mic_device - MIC device information for each card.
> + *
> + * @name: Unique name for this MIC device.
> + * @mmio: MMIO bar information.
> + * @pdev: The PCI device structure.
> + * @family: The MIC family to which this device belongs.
> + * @ops: MIC HW specific operations.
> + * @id: The
2013 Aug 12
1
[PATCH v2 1/7] Intel MIC Host Driver for X100 family.
On Wed, Aug 07, 2013 at 08:04:07PM -0700, Sudeep Dutt wrote:
> +/**
> + * struct mic_device - MIC device information for each card.
> + *
> + * @name: Unique name for this MIC device.
> + * @mmio: MMIO bar information.
> + * @pdev: The PCI device structure.
> + * @family: The MIC family to which this device belongs.
> + * @ops: MIC HW specific operations.
> + * @id: The
2006 Apr 30
4
Adding values from a db the rails way?
I have a log table which has a column recording the number of hours
worked on a task. So there''ll be multiple lines for a particular task.
I want to retrieve the total number of hours worked on a task, so that I
can include the information when one views the task details.
I can write a sql query to do this easily enough, like "SELECT
SUM(hours) AS total FROM tasklog WHERE
2006 Feb 07
5
OCI adapter slowdown on dictionary access
Hi,
after some experience with Rails on MySQL databases I gave it a try on one
of our larger Oracle database.
I was facing a problem when Rails tried to detect the columns for a
model/table. The appropriate statement ran about 1 min which led to a
timeout.
Our Oracle guru told me to analyze the SYSTEM schema. After that hadn''t
helped, he said the only remaining chance is to use a
2006 Jan 11
8
Oracle and Rails seems really slow.... In development
I''m just looking into how to connect to Oracle using Rails. I''ve got
everything connecting and working as it should.
I have a Users table in Oracle:
create_table "users", :force => true do |t|
t.column "username", :string
t.column "created_on", :datetime
t.column "email", :string
t.column "note", :text
2006 Jan 02
5
How to use MySQL sum() to get total of column?
Easy one: Let''s say I have a table called ''employees'' with a column
called salaries, how can I add Employee.salaries_total to the model?
Thanks!
--
Posted via http://www.ruby-forum.com/.
2010 Mar 30
2
remove_index missed quote_table_name
in lib/active_record/connection_adapters/abstract/schema_statements.rb
there is a missing quote_table_name in line 286 (def remove_index):
execute "DROP INDEX #{quote_column_name(index_name(table_name,
options))} ON #{table_name}"
so my "keys" table can get an index with "add_index" but can''t remove
it (without tweaking)
replacing it to
execute
2005 Apr 23
2
[Tip] Introspection to determine if a column may be null
I still want to get this into Rails for all connection adaptors, but
for now I''ve hacked my own addition on for just PostgreSQL.
The following code extends every Column object returned by
MyModel.columns to support a new #required? method, which indicates if
the column may or may not be null.
The following is a huge hack - suggestions on a cleaner way to add this
functionality
2009 Sep 22
6
Import excel / csv files
Hey,
What way is the best to do imports of CSV files?
2007 Oct 31
1
how does table_name static method work ?
There has to be a simple explanation for this.
I can do this to get the table name behind a model
>> User.table_name
=> "users"
Great. But looking at the table_name code in active_record/base.rb,
the table_name method is not static (no self.)!
def table_name
reset_table_name
end
So why can I call table_name as a static method ???
2007 Sep 13
7
Namespacing Models
Hello everyone,
Do you feel it? The little shiver down your spine when you think of
"namespacing" in rails? To some thats a common feeling, to people like
myself who enforce absolute organization have already thought about
the need for namespaces in rails.
Now I do understand this is an ongoing effort... to some degree.
Controllers and routes, from my experiences work well, that being,
2005 Mar 08
4
change the model''s table name
I need to change the name of the table a model is connected to... like
the example in the API... the table is called mice and I want a class
called Mouse.
class Mouse < ActiveRecord::Base
table_name "mice"
end
I''m doing this cause I want tables in my language (italian) and avoid
the nameS thing.
just adding it in that way doesn''t work
ArgumentError in
2006 Feb 25
5
MySQL client ran out of memory
I''m getting the following error unexpectedly for my rails app. I just
exported the databae from dreamhost and imported it on textdrive for
my rails app.
Mysql::Error: MySQL client ran out of memory: SELECT COUNT(*) FROM
comments WHERE (comments.listing_id = 2666)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
2005 Nov 18
6
wrong number of arguments (2 for 1) error message help
All,
This is really starting to get me as i can''t figure out why I am
getting this error. Here is what is going on. I have a table called
items and a item controller. When I add a new item to the items table
I am also creating several associated tables. the code for this so
that you can follow along is:
def create
@item = Item.new(params[:item])
# The item belongs to
2010 Aug 04
1
Question regarding S4 objects and reading in excel data with RODBC
L.S.
I am trying to get data from an excel sheet using the RODBC library, quite
like the example on page 34 of the 'Data manipulation with R' book written
by Phil Spector. It seems very straightforward, yet I get the same error
everytime I try it, with different excel sheets and trying to tweek the code
a bit. This is what I do:
library(RODBC)
sheet='X:\\example.xls'