Displaying 20 results from an estimated 4000 matches similar to: "ActiveRecord increment confusion"
2013 Jan 20
20
ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates
The method is here:
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/persistence.rb#L288.
The method takes the in-memory attribute value and increments it by the
specified amount. A safer approach (from an isolation standpoint) would be
to let the database determine the value. Instead of telling the database
what value to persist in the database, the SQL can written
2004 Aug 06
1
Fallback behaviour
Hi:
I'm looking at Icecast's fallback behaviour, particularly with the fallback
override fuctionality that's in SVN Icecast. Everything works well *if*
you
connect the client whilst the primary stream is connected. When that
source drops out, you fall through to the backup, and you get pulled
forward when it reconnects. All well and good. But if you try to connect
when the
2003 Aug 02
1
Cross Platform Mixers and LibAO
Hello Vorbis Developers.
I'm in the proccess of writing an OggVorbis audio player using libao and
libvorbisfile. I've greatly appreciated the simplicity of the API and
good documentation with the souce of the libraries. I've descided that I really want a mixer on my player, and I'm unsure
how to best go about it. LibAO (unless I'm absolutely blind) doesn't
2007 Aug 12
4
freebsd ports provider
I''d like to clarify some points about the ports/package system in FreeBSD. I apoligize
ahead of time if this is
Both packages and ports use the pkgdb system. This isn''t some lame cludge; it''s by design,
and the reason is really quite simple. Packages are built from the ports collection. The
only real difference between them is the mode of delivery.
When you run
2012 May 14
2
unicorn <3
hey, i am a big unicorn fan -- i have been running it in production
since
late 2010, and it is happily handling (literally) billions of backend
requests
for a popular facebook game.
i also <3 unicorns in general ..... so i decided to make an awesome t-
shirt,
sporting the "Angry Unicorn" that you may remember from github error
pages.
i hope some of you might like it as well:
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 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 Oct 25
1
how to use increment_counter in model
Hi,
Here''s my controller function:
>>>
def feed
@chriss_monster = ChrissMonster.find(params[:id])
@chriss_monster.feed
redirect_to :action => ''list''
end
<<<
Here''s my model:
>>>
class ChrissMonster < ActiveRecord::Base
def feed
ChrissMonster.increment_counter :eat, :id
end
end
<<<
When I call the
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
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,
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 Jul 20
11
Any good alternative to single-table-inheritance?
I''m looking to implement model inheritance in a new application. Is
there any good alternative to single-table-inheritance?
--
-Alder
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
Hi All, I''ve tried to do my searches, but can''t find reference to
this anywhere - My question is about ActiveRecord inserts and IDs. I
have a join table that both the models of the source tables join with
"has_and_belongs_to_many". It seems like ActiveRecord is setting the
"id" field for the join table- This should be an auto_increment and
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 May 31
1
Creating Multiple Child objects on a single form
I''ve been trying to solve this for the last few hours and I have
something that is working now but I''m curious if there isn''t a better
''right'' way to do it since this seems a bit of a cludge to me, but I
haven''t find a better way to make it work.
The models are as follows:
Goals, which have multiple objectives.
Goals also have multiple
2004 Sep 10
0
[Flac-users] Re: my flac -t issue: next approach
It can but is probably not as nice as youwould like.
flac -t *.flac
if errorlevel 1 goto fail
goto exit
:fail
echo Danger Will Robinson! Flac files failed integrity check.
:exit
For this reason cygwin and its bash for windows does a lot more.
Notes on the batch file fragment above:
if errorlevel 1 goto
actually means if errorlevel 1 or greater
so don't try if errorlevel 0 since it will
2005 Jan 12
1
Samba on Snap
Hi,
We have a snap server 4400 which is running Samba and which we have
successfully added to our Samba domain which is running on a Sun. However,
when we save a file on the Snap server, the unix owner/group are set
incorrectly to the values 20111 and 20002. A file saved on the Sun server
has the correct unix owner/group.
Consequently, the file save on the snap server cannot be edited at the
2005 May 09
1
Configuring SPA-3000 As A Trunk
We have just posted a review of the Sipura SPA-3000 with a complete setup
guide for using the device as a trunk to Asterisk. It is easy to setup and
works as good as any Zaptel setup and includes an ATA. It really is one cool
device!
http://www.geekgazette.com/index.php?option=com_content
<http://www.geekgazette.com/index.php?option=com_content&task=view&id=28>
2008 Oct 16
2
DAHDI and wait 'w'
-- Attempting call on DAHDI/1wwwwww for
smvoice_callprogress at smvoice-dialout:1 (Retry 1)
[Oct 16 14:36:42] WARNING[16408]: chan_dahdi.c:8132 dahdi_request:
Unknown option 'w' in '1wwwwww'
[Oct 16 14:36:43] WARNING[16408]: chan_dahdi.c:1481 dahdi_enable_ec:
Unable to enable echo cancellation on channel 1 (No such device)
Does DAHDI not know about the W ??? I think zaptel used
2009 Apr 21
2
QuickBooks Enterprise DB Server
Anyone running this POS on CentOS and can spare some info? Support
is useless, and it's just not working:)I am not getting a qbdir.dat
file created, and the error log is, well, empty!
jlc