Displaying 20 results from an estimated 10000 matches similar to: "how to use increment_counter in model"
2006 Apr 18
1
what happened to my increment_counter method?
this used to work for me. i started re-writing my little app and now
it doesn''t work.
here''s my models:
class Company < ActiveRecord::Base
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :Company, :counter_cache => true
end
then i go into my console and say:
c = Company.find(:first)
c.increment_counter
and its all like "waaaaaaH"
2006 Mar 11
2
ActiveRecord increment confusion
Part of my application counts the number of times a link was clicked.
The Link.click function should increment the @link.clicks attribute.
I assumed
def click
@link = Link.find(params[:id])
if @link.increment(''clicks'')
redirect_to @link.url
else
flash[:error] = ''Could not update clicks''
redirect_to :action =>
2005 Dec 05
2
plot() and points() precision control
Hi all,
I have a problem in that when I plot points that have a high degree of
precision, some significant rounding seems to occur, resulting in
uneccessary overlap of my points. Is there a way to specify the
resolution or precision in plotting functions? Is there an underlying
grid I have to modify somehow?
Many Thanks,
Jon
--
Mares eat oats and does eat oats and little lambs eat ivy. A
2007 Nov 14
7
BackgrounDRb version 1.0RC1 available now
Hi Folks,
BackgrounDRb is a Ruby job server and scheduler. Its main intent is to be
used with Ruby on Rails applications for offloading long-running tasks.
Since a Rails application blocks while serving a request it is best to
move long-running tasks off into a background process that is divorced
from http request/response cycle.
This new release of BackgrounDRb is also modular and can be used
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
2009 Jun 01
4
counter_cache is making a redundant SELECT before UPDATE
Hi,
I have the following code:
Message, belongs_to :topic, :counter_cache => true
topic = Topic.find_from_permalink(params[:id])
topic.messages.create(params[:message])
When the message gets created, then AR issues a supplemental SELECT to
retrieve the message''s topic and then updates its messages_count. Why is
that happening?
If I do it manually:
if
2004 Mar 02
2
Stuck in trying to convert repetitive code into a function
Folks,
I have the following repetitive code which works correctly:
A = read.table(file="junior.csv", sep=",", col.names=c("date", "l"));
A$date = chron(as.character(A$date), format="m/d/y");
r.junior = levels2weeklyret(lastfriday, A$date, A$l);
plot(A$date, A$l, type="l", col="red", main="Junior levels")
2016 Jul 27
1
[PATCH] builder: fix EOF check with flex >= 2.6.1
It looks like flex 2.6.1 changed [1] the return code for EOF in
yyinput. Therefore, use the right value depending on the version of
flex which generates the lexer.
[1] https://github.com/westes/flex/commit/f863c9490e6912ffcaeb12965fb3a567a10745ff
---
builder/index-scan.l | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/builder/index-scan.l b/builder/index-scan.l
2011 Sep 19
3
Metadata syntax (was Universal syntax for Markdown)
fletcher said:
> For any consensus to come about,
> I think we need to agree on the
> fundamental purpose and philosophy of
> the consensus we claim to be interested in.
it would be nice.
> Otherwise many of these discussions will
> continue to occur without much hope of
> moving forward to any actual outcome/resolution.
yep.
> it's
2010 Feb 17
2
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
I am new to llvm so I might be missing a critical step. My system is
Fedora 12 but this also happens in Mac OS X 10.6.2. Here are the
steps I used to compile llvm:
export TARGETS=x86,x86_64,cpp
export INSTALLDIR=/home/rovitotv/llvm
../llvm-2.6/configure --prefix=$INSTALLDIR --enable-bindings=none
--enable-targets=$TARGETS --enable-optimized
--with-llvmgccdir=$INSTALLDIR
2010 Feb 17
0
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
First, you have to call llvm-g++ to use the llvm-gcc front end, but it
doesn't matter here.
I'd like to suggest that you use pastebin to put your code and the send us
the link, so that we can download it. The problem is that TheExecutionEngine
is set to NULL (maybe because of a previous error), but it will be really
better if you use pastebin.
On Wed, Feb 17, 2010 at 6:01 AM, Todd Rovito
2011 Sep 07
1
Clearcase, Samba, and mnode values
Hi all --
I recently temporarily deployed an upgraded Clearcase server (7.1.2.3)
on 64 bit RHEL 5.6. With it I was using Redhat's release of Samba for
that version of the OS -- 3.0.33. The system has 32 GB of memory
and within 12 hours, it would be down into swap. Maximum active
licenses used is 36 but a more typical load is 18-25 users having a
Clearcase license at once. Clearcase
2007 May 14
3
Counter Problem
Hi. I have a problem with counters in Rails. The situation looks like
this:
-3 simple models
class Forum < ActiveRecord::Base
has_many :posts
end
class Topic < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :topic, :counter_cache => true
belongs_to :forum, :counter_cache => true
end
- In migrations i have declared
t.column :posts_count,
2016 Feb 26
2
winbind limitations
Hi Volker,
I have same behaviour here without enumerating users or groups. As soon as
the DB increase too much (which is not too much, my tests months ago made
Samba starting to hang on certains commands (ldapcmp, wbinfo -u...) around
40000 objects in Samba database.
On DC wbinfo -u is hanging today after 10s. This on the 2 DC I tested (on
20 DC). As soon as wbinfo -u is launched RPC PID of
2010 Jun 16
5
Disabling services in CentOS 5.5
Hello all,
I have been doing some searching for information about disabling
services within a CentOS 5.5 install. I have found a few different
opinions, and wanted to ask for some feedback.
First off, the system is running a LAMP stack to serve a web
application. It will only be doing email to send occasional messages
out (sent via the application only). It will not be receiving email
for any
2009 Sep 07
11
autoincrement for non-id column
There is a table:
execute (<<-SQL)
CREATE TABLE "tasks" (
"id" serial primary key,
"number" serial,
"version" integer DEFAULT 0 NOT NULL,
"latest_version" boolean DEFAULT ''t'' NOT NULL,
"hidden" boolean DEFAULT ''f'' NOT NULL,
"type" character varying (1) NOT
2006 Apr 16
1
[Fwd: Re: voicemail email-from]
Ronald Wiplinger wrote:
> Steve Totaro wrote:
>> Ronald Wiplinger wrote:
>>> kevin ling wrote:
>>>> Hi,
>>>>
>>>> Check the vm_general.inc file
>>>>
>>>>
>>> Where should this file be?
>>>
>>>
>>> bye
>>>
>>> Ronald Wiplinger
>>>
>>>
>> You
2007 Dec 20
1
indexing tuples (example: "frog" => 123) as opposed to words
Hi,
I need to map words in a document back to there original word id''s in my
database. For example, if I had the sentence "I eat food" and I was
searching for "food" I would obviously get the document back as a
result. For my particular problem I need to not only get the document id
but also the id of the match.
Suppose my original sentence was actually
2009 Aug 14
4
theora sprint done :)
all done! ... we will check through the format a bit and make some
alterations, but the first version is available now...
http://en.flossmanuals.net/theoracookbook
http://www.lulu.com/content/7531795
212 pages of all you can eat free video :)
adam
--
Adam Hyde
Founder FLOSS Manuals
German mobile : + 49 15 2230 54563
Email : adam at flossmanuals.net
irc: irc.freenode.net #flossmanuals
2006 Apr 07
4
Big fcgi problem...
Hi all
My lighty spawn 10 fcgi process, some times, one or two of them will
eat all most 90% CPU, when i kill them, everything is ok.
I want a script to auto kill these Big fcgi,
could you give me some advise?
regards
--
Posted via http://www.ruby-forum.com/.