Displaying 12 results from an estimated 12 matches for "insert_record".
2005 Mar 07
6
Automatic timestamping in join tables [596]
Hi,
A few days ago I submitted the following ticket
http://dev.rubyonrails.com/ticket/596
asking that ActiveRecord::Timestamp also apply for the join tables of
habtm.
The answer was that it was left for milestone 1.x, and since I think
that without this functionality rails 1.0 would be incomplete, I''m
raising the issue here to discuss it.
My use case is very simple, I
2009 Jun 04
1
wrong number of arguments (1 for 0)
...they all work
ok, I can do manually what I''m trying to do with Rails. There is
something in the code somewhere outside of the model code that is
causing this problem and I''m at a loss to track it down.
I''ve traced into the code for has_many_associations.rb:
def insert_record(record, force = false, validate = true)
set_belongs_to_association_for(record)
force ? record.save! : record.save(validate)
end
and it blows up on the force ? record.save! : record.save(validate)
line. Here is the stack trace:
wrong number of arguments (1 for 0)
RAILS...
2009 Sep 09
0
Rails 2.3.4 ActiveRecord association problem
...parent.
Top of the stack:
wrong number of arguments (1 for 0)
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
associations/has_many_association.rb:61:in `save''
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
associations/has_many_association.rb:61:in `insert_record''
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
associations/association_collection.rb:119:in `<<''
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
associations/association_collection.rb:433:in
`add_record_to_target_with_callbacks''...
2006 Aug 08
1
File upload into Mysql (using lighttpd) problem
.../active_record/transactions.rb:118:in
`transaction''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/transactions.rb:126:in
`save''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/associations/has_many_association.rb:143:in
`insert_record''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/callbacks.rb:343:in
`callback''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.1/lib/active_record/associations/association_proxy.rb:110:in
`method_missing''
/usr/local/lib/ruby/gems...
2006 Jan 31
2
How can I overwrite the parent.children.push(child) Method?
Hi all
I want to overwrite the push method (which is an alias of <<, the same
as concat) of collections, and there I want to test if :uniq is set to
true in the relationship. If so, the method should check if the passed
object is already related to the parent, or not (only then it will be
added).
But I just can''t find the original code of this method, so I could
overwrite
2005 Aug 15
0
RE: has_many_belongs_to_many insert issues [CLOSED]
...nderstand why
Rails generated this buggy statement.
If I had the relationship by hand in SQL, I can perfectly issue a find
in Rails or retrieve it.
>From the source code, it looks like:
File:
activerecord-1.11.1.1962\lib\active_record\associations\has_and_belongs_
to_many_association.rb
Method: insert_record
Lines 121 and 123 seem to work as I get something in the breakpointer.
And I guess line 139, since I cannot make the @owner.send work:
"INSERT INTO #{@join_table}
(#{@owner.send(:quoted_column_names, attributes).join('', '')}) " +
"VALUES...
2006 Jan 09
4
Problem with habtm and resulting SQL insert
Cheers,
I have a problem with 1.0 and a habtm relationship between User and Article.
I want to save all articles that users read. I have these models:
class User < ActiveRecord::Base
has_and_belongs_to_many :read_articles, :class_name => "Article",
:join_table => "read_articles"
...
end
class Article < ActiveRecord::Base
has_and_belongs_to_many :readers,
2006 Aug 15
0
SystemStackError: stack level too deep
...`save_without_validation''
from
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/validations.rb:744:in
`save''
from
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:160:in
`insert_record''
from
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:26:in
`<<''
from
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:23:i...
2008 Aug 31
9
assigning collection values and exceptions
....
The owner object (Report) already exists, and every invalid Reason
assigned through << will simply result in a raised
ActiveRecord::InvalidRecord exception. This is best described directly
into rails'' code in association_collection.rb (<<) and
has_many_through_association.rb (insert_record).
Now I may trap this exception in controller and do something with it,
however I lose in some way my validation error messages on my form,
which is dynamic (add/remove reasons via js).
The reason why I''m not using :accessible or some other plugin to ease
multimodel forms is that they wa...
2005 Sep 06
6
strange behavior of acts_as_taggable
...#39;'
from ./script/../config/../vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:109:in
`execute''
from ./script/../config/../vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb:135:in
`insert_record''
from ./script/../config/../vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb:86:in
`push_with_attributes''
from ./script/../config/../lib/taggable.rb:286:in `tag''
from ./script/../config/../lib/taggab...
2013 Oct 23
0
Error: allocator undefined for Proc
...0/lib/active_record/transactions.rb:248:in
`rollback_active_record_state!''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:236:in
`save''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/has_many_association.rb:66:in
`insert_record''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:151:in
`send''
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:151:in
`send''
/usr/lib/ruby/gems/1.8/gems/activerecord-3....
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
...ems/arel-1.0.1/lib/arel/session.rb:17:in `create''
from /Library/Ruby/Gems/1.8/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:159:in `insert''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/has_and_belongs_to_many_association.rb:70:in `insert_record''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_collection.rb:136:in `<<''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_collection.rb:479:in `add_record_to_target_with_callba...