Displaying 7 results from an estimated 7 matches for "insert_sql".
Did you mean:
insert_s
2006 Feb 21
3
HABTM :insert_sql help
...d `record'' for Project:Class''
has_and_belongs_to_many :people,
:class => ''Person'',
:join_table => ''ProjectTeamRole'',
:foreign_key => ''ProjectID'',
:association_foreign_key => ''PersonID'',
:insert_sql => "INSERT INTO
ProjectTeamRole(ProjectID,PersonID,TeamRoleID) VALUES(#{id},
#{record.PersonID},1)"
I can see that #id refers to the current Project object, but how do I
refer to the PersonID that will be inserted if not as above??
thanks!
rich
2006 Jan 03
0
habtm and insert_sql
Briefly, I want to create an :insert_sql attribute for
a has_and_belongs_to_many relationship, and then add items to that
relationship using push_with_attributes. Is that possible?
Less briefly:
I have a legacy postgresql database where one of the join tables has an
ID column, so I had to set up the association with a custom :finder_s...
2006 Jun 16
3
Does HABTM support non "id" FKs?
Quick question. Say I have a geographical database with counties and zip
codes where counties have and belong to many zip codes.
zip_codes (id, zip_code)
counties (id, name)
When I create the association table, the Rails way says to do the
following: counties_zip_codes (county_id, zip_code_id).
However, given that zip_codes.zip_code is itself a candidate key, I
would much prefer to do the
2008 Apr 04
0
Can''t get backgroundrb to work with rails plugin ''batched_sql_fu''
...ocess and insert a large list of bulk
records, but when I try to use it with the batched_sql_fu plugin
installed in vendor/plugins, I get the following error:
---SNIP---
/Users/jdonalds/Sites/3dial_ads/config/../vendor/plugins/
batched_sql_fu/lib/batched_sql_fu/active_record.rb:22:in
`alias_insert_sql_to_batched_version!'': undefined method `insert_sql''
for class `ActiveRecord::ConnectionAdapters::MysqlAdapter'' (NameError)
from /Users/jdonalds/Sites/3dial_ads/config/../vendor/plugins/
batched_sql_fu/lib/batched_sql_fu/active_record.rb:8:in
`insert_by_batch'...
2006 Jan 04
5
habtm recusive
I have a people table:
CREATE TABLE people (
id int(10) unsigned NOT NULL auto_increment,
first_name varchar(75) default NULL,
middle_name varchar(75) default NULL,
last_name varchar(75) default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1272 ;
and a people_people table:
CREATE TABLE people_people (
person_id int(11) unsigned NOT NULL,
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
...dapter.rb:202:in `log''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:263:in `insert_sql''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:149:in `insert_sql''
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert''...
2010 Dec 10
0
Encoding issues when uploading files
...ese characters, I
get this error - only difference is, that it is burried somewhere deep
inside AREL:
incompatible character encodings: UTF-8 and ASCII-8BIT
arel (1.0.1) lib/arel/engines/sql/relations/compiler.rb:85:in `join''
arel (1.0.1) lib/arel/engines/sql/relations/compiler.rb:85:in
`insert_sql''
arel (1.0.1) lib/arel/algebra/relations/writes.rb:32:in `to_sql''
arel (1.0.1) lib/arel/engines/sql/engine.rb:30:in `create''
arel (1.0.1) lib/arel/algebra/relations/writes.rb:24:in `call''
arel (1.0.1) lib/arel/session.rb:17:in `create''
arel (1.0.1) lib/a...