Displaying 20 results from an estimated 74 matches for "create_or_update".
2009 Mar 11
6
Monkey Patching a Plugin
I am using a plugin that adds a method to ActiveRecord::Base. The
added method is called self.create_or_update. I need to monkey patch
this method. I tried in lib/ config/initializers and in
environment.rb, but the one in the plugin is always the one that is
run.
Where do I put my version of the method so that it overrides that of
the plugin? I only use this method when running a rake task, so that
may hav...
2006 Jan 20
3
Is there a way to validate a model w/o saving it?
...ady been saved, so when the user fixes the fields and
resubmits the validates_uniqueness_of check fails for the account
(since it was already saved to the db).
I''ve looked through the rdoc for ActiveRecord::Base and don''t see a
method which would validate in the same way that the create_or_update
method does.
Thanks,
Sean
2008 Jun 04
2
Overriding default ActiveRecord behaviour
Hello everybody,
By default doing like this:
person = Person.new
person.name = "John"
person.save!
Will cause a new row to be inserted into database. But I don''t want it
to be saved into DB, instead when "save!" method is called I want to
connect to a particular URL and post data to it.
For instance:
POST http://my.app/people/create
"name" =>
2006 Mar 16
10
Nubee Callbacks problem
I never want to alter a model(row). When a model has been changed i
want a new copy to be created.
What is the best way to implement this?
I think using callbacks might be the answer.
So model.save will create a new row, and leave the old one unchanged.
Any ideas? I can easily implement this in the controller but i''d rather
it be done transparently. Also errors should be passed back
2010 Sep 27
0
problem with set_sequence_name please help
...ive_support/callbacks.rb:428:in
`_run_create_callbacks''
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281:in
`create''
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247:in
`create_or_update''
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
`create_or_update''
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428:in
`_run_save_callbacks''
from
/Users/...
2012 Feb 22
3
Parent id for find_or_create method
..."new_script", :locals => { :script =>
Script.new(:video_id => @video.id)} %>
which works fine. Now I would like to develop further. The Script
objects may have already existed and if so, I want to update after
editing them.
So I tried,
<%= render :partial => "create_or_update_script",
:locals => { :script => Script.find_or_create_by_video_id(:video_id =>
@video.id)} %>
renders a partial,
<%= form_for script,
:url=>{:controller=>''scripts'', :action=>''create_or_update''},
:remote => true do |f|...
2010 Jul 28
5
db:fixures:load does not call Model.save()
...< ActiveRecord::Base
def save
self.equal = self.plus - self.minus
super
end
end
$ cat test/fixtures/balances.yml
_10-1:
plus: 10
minus: 1
$ rake db:fixtures:load
$ sqlite3 db/development.sqlite3
sqlite> select * from balances;
//=> |xxx|10|1||...
// equal is not 9
Even create_or_update() was the same.
Should I write it as
equal: 9
in the fixture-file?
It''s not DRY.
Thanks.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G...
2006 Mar 08
0
call activerecords private methods
...s answer and I''m being dumb,
but why does activerecord allow me to call it''s
private methods?
>> i = Item.find(33)
=> #<Item:0x2360080 @attributes={ ... output removed
>> i.price = ''25''
=> "25"
>> i.update
=> 1
>> i.create_or_update
=> 0
>> i.price = ''26''
=> "26"
>> i.create_or_update
=> 1
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
2006 Oct 31
2
corrupted index preventing save
Hi, I''m using Rails/AAF with Ferret 0.10.11, and my index occasionally
(every few weeks, roughly) becomes corrupted.
If the index is busted, until I rebuild it our users are unable to save
anything. I get errors like the one below, and the save rolls back.
My question is, is there any way to catch the error, and continue with
the save even if the model isn''t indexed? What
2006 Apr 04
6
Oracle Problem. Maybe driver
...ems/activerecord-1.14.0/lib/active_record/callbacks.rb:274:in
`update_without_timestamps''
/opt/tools/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/timestamp.rb:39:in
`update''
/opt/tools/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1712:in
`create_or_update_without_callbacks''
/opt/tools/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:249:in
`create_or_update''
/opt/tools/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1388:in
`save_without_validation''
/opt/tools/lib/ruby/gems/1...
2006 Jul 20
1
file_column - assigning with an actual file rather than a multipart
...ord-1.14.3/lib/active_record/callbacks.rb:333:in
`callback''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/callbacks.rb:330:in
`callback''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/callbacks.rb:250:in
`create_or_update''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1392:in
`save_without_validation''
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/validations.rb:724:in
`save_without_transactions''
f...
2013 Oct 23
0
Error: allocator undefined for Proc
...gems/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:415:in
`_run_update_callbacks''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:285:in
`update''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247:in
`create_or_update''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
`create_or_update''
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428:in
`_run_save_callbacks''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/activ...
2012 Aug 14
1
NoMethodError: undefined method `accept' for nil:NilClass
.../active_support/callbacks.rb:81:in
`run_callbacks''
from
/Users/blaine/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:268:in
`create''
from
/Users/blaine/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/persistence.rb:344:in
`create_or_update''
from
/Users/blaine/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:264:in
`block in create_or_update''
from
/Users/blaine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:403:in
`_run__3940325652772678349__save...
2006 Aug 25
6
End-of-File Error occured at <except.c>:103 in xpop_context
...ems/activerecord-1.14.4/lib/active_record/callbacks.rb:266:in
`create_without_timestamps''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/timestamp.rb:30:in
`create''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1718:in
`create_or_update_without_callbacks''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:253:in
`create_or_update''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1392:in
`save_without_validation''
/usr/local/lib/ruby/gems/1...
2007 Oct 30
1
Merb - Losing connection to MySQL
...ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:254:in
`create_without_timestamps''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/timestamp.rb:30:in
`create''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1792:in
`create_or_update_without_callbacks''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:242:in
`create_or_update''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1548:in
`save_without_validation''
/usr/lib/ruby/gems/1.8/gems/activerecord...
2006 Jul 14
1
error with Dates in SQL Server
...cord/lib/
active_record/
allbacks.rb:261:in `create_without_timestamps''
from ./script/../config/../vendor/rails/activerecord/lib/
active_record/
imestamp.rb:30:in `create''
from ./script/../config/../vendor/rails/activerecord/lib/
active_record/
ase.rb:1718:in `create_or_update_without_callbacks''
from ./script/../config/../vendor/rails/activerecord/lib/
active_record/
allbacks.rb:249:in `create_or_update''
from ./script/../config/../vendor/rails/activerecord/lib/
active_record/
ase.rb:1392:in `save_without_validation''...
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2010 Dec 10
0
Encoding issues when uploading files
...) lib/active_record/callbacks.rb:281:in `block in
create''
activesupport (3.0.0) lib/active_support/callbacks.rb:413:in
`_run_create_callbacks''
activerecord (3.0.0) lib/active_record/callbacks.rb:281:in `create''
activerecord (3.0.0) lib/active_record/persistence.rb:247:in
`create_or_update''
activerecord (3.0.0) lib/active_record/callbacks.rb:277:in `block in
create_or_update''
activesupport (3.0.0) lib/active_support/callbacks.rb:418:in
`_run_save_callbacks''
activerecord (3.0.0) lib/active_record/callbacks.rb:277:in
`create_or_update''
activerecord (...
2007 Oct 07
1
How to store a Mechanize object in the database?
...ms/activerecord-1.15.3/lib/active_record/callbacks.rb:254:in
`create_without_timestamps''
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/timestamp.rb:39:in
`create''
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1789:in
`create_or_update_without_callbacks''
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:242:in
`create_or_update''
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1545:in
`save_without_validation''
from /var/lib/ge...
2006 Aug 08
1
File upload into Mysql (using lighttpd) problem
...verecord-1.14.1/lib/active_record/callbacks.rb:261:in
`create_without_timestamps''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/timestamp.rb:30:in
`create''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/base.rb:1718:in
`create_or_update_without_callbacks''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/callbacks.rb:249:in
`create_or_update''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/base.rb:1392:in
`save_without_validation''
/usr/local/lib...