Displaying 20 results from an estimated 2000 matches similar to: "HABTM and has_many through only work in one direction"
2019 Apr 16
3
PROBLEMAS NOMBRES DE COLUMNAS CON ESPACIOS CONEXION R-SQL
Buenas tardes,
Estoy tratando de realizar un update en SQL desde R:
sqlUpdate(conexion1, data.frame(AUXILIAR), tablename = "AUXILIAR")
y me devuelve el siguiente error:
*Error in sqlUpdate(conexion1, data.frame(AUXILIAR), tablename =
"AUXILIAR", : *
* data frame column(s) Corteoptimo Cortediario not in database table*
El problema es que sí existen esas columnas en SQL pero
2007 Jan 16
1
RODBC: sqlQuery is successful, but a similar sqlFetch returns error
Greetings guRus --
I have successfully queried a large (24,445 rows by 281 cols.) in-house
database using the following RODBC query (without the line breaks)
testout <- sqlQuery(channel, "select idSchedule,EXCL_Total from
dbo.vwC1198_2006_RawData_With_CMPL_EXCL")
This returns a dataframe of 24445 rows and two columns (as intended),
but the following command
testout
2001 Nov 13
1
RODBC
I'm tryuing to get the RODBC package to work with a MS Sql database
(Wonderware's InSQL). I'm able to connect to the database using the
following:
version
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status Under development (unstable)
2011 Nov 10
1
Help: sqlSave Error
I am using sqlSave to save my data into an existing table at MS SQL Server
database. Previously my code ran smoothly but all of a sudden it stopped
working. Here is my code:
sqlSave(con, highVol, "dbo.futuresHighVol", append=TRUE, rownames=FALSE)
Error: sqlSave(con, highVol, "jrgchis.dbo.futuresHighVol", append = TRUE, :
42S01 2714 [Microsoft][ODBC SQL Server Driver][SQL
2006 Feb 16
1
HABTM -VS- belongs_to/has_many, for self-referential joins
Ok, David says on page 241 that sometimes a many-to-many relation with
attributes are better implemented as an actual model instead of using HABTM.
Well, I''ve got that situation and I can''t figure it out.
All of the examples in the book have HABTM examples between 2 different
tables, but I want to have a HABTM relation on 1 table with itself. (e.g.,
if I have a table Things,
2012 Aug 16
3
Reference a variable inside a string and another for object assingments
Hi R community
I copied a bit of my R code that gets some data from a database. You
won't be able to run the code, but I am a beginner so you will
probably understand what going on.
I would like to make a variable I can refer to inside the sqlQuery.
Instead of writing the start date and time (ex SP.lokaldatotid >=
'2005-01-01 00:00:00') inside the query I would like to define it
2006 Jul 10
4
HABTM vs. using has_many :through
All,
I''ve heard recently about has_many :through as a necessary alternative
to HABTM (when the join table has it''s own id column, say, in a legacy
schema). However, is the prevailing Rails wisdom now that one should
use has_many :through in _all_ cases?
If so, why?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Jun 20
0
habtm has_many through and foreign keys
I have two models
Role and Task
..and a join table/model RoleTask
Now both roles and tasks have id as a primary key and name which is a
unique identifier
I want the join table to hold role_id and task_name
I''ve tried using habtm with foreign key and association foreign keys set
up and I''ve tried using has_many :through
..but they all seem to someone want to work with the
2007 May 04
1
habtm and also has_many of the same things
Hi,
our app is a situation where users can upload files and also mark files
uploaded by other users as their favorites. So for the favorites we are
using a simple many-to-many with a tie table.
So in attempting that it looks like
class User < ActiveRecord::Base
has_and_belongs_to_many :media_file
has_many :media_file
end
class MediaFile < ActiveRecord::Base
2010 Oct 03
1
Package for converting R datasets into SQL Server (create table and insert statements)?
Hi,
R contains many good datasets which would be valuable in other
platforms as well. My intention is to use R datasets on SQL Server as
a sample tables. Is there a package that would do automatic conversion
from the dataset "schema" into a SQL Server CREATE TABLE statement
(and INSERT INTO statements)?
For example.
> str(cars)
'data.frame': 50 obs. of 2 variables:
$
2007 Oct 15
0
converting from HABTM to has_many :through
Hello,
I have a has_and_belongs_to_many relationship that I''ve realized I need
to add additional attributes to. So I''m converting it to a has_many
:through (HMT) relationship. This is the first time I''ve used an HMT,
and it seems like I''m using too much code. I couldn''t figure out how to
get the join model objects to update automatically as a result of
2006 Mar 22
2
habtm vs. has_many/belongs_to
In AWDWR David says (pg 232),
"When a Join Wants to Be a Model:
While a many-to-many relation with attributes can often seem like the
obvious choice, it?s often a mirage for a missing domain model. When
it is, it can be advantageous to convert this relationship into a
real model
and decorate it with a richer set of behavior. This lets you
accompany the
data with methods.
As an example,
2009 Jun 22
5
has_many through , or habtm , using form
i think there ara two ways of relate products and categories ,
basically i want to fix one product(e.g hp dv7....) to some categories
(notebook,17"notebooks...)
i made a table named categorization(incuding category_id,product_id
fields) then in models i write these codes below
class Product < ActiveRecord::Base
has_many :categories, :through => :categorizations
2006 Jul 10
7
What is has_many :through really buying you over HABTM?
So having just learned how to do has_many :through as opposed to HABTM,
and then, being concerned that I wouldn''t get it to work, I started
thinking about these two approaches.
It seems to me that the _only_ problem that the HM:T (has_many :through)
approach solves that HABTM doesn''t is the issue of the potential
collision of id columns between your join table and one of
2006 Aug 09
3
HABTM and getting to arrays from either direction
I didn''t find exactly an answer on this one, so I''d like to get a
clarification from folks who live & breathe HABTM.
class foo
has_and_belongs_to_many :bars
end
class bar
has_and_belongs_to_many :foos
end
(and yes, I have a bars_foos table in my db)
def test_habtm
bar = Bar.new
foo = Foo.new
foo.bars<<bar
assert !foo.bars.empty?
assert
2006 Aug 18
1
join update seperation?
I have a legacy DB without access to change the user or group table
(must use StoredProcedures to edit those). But I do have access to the
usergroup join so I thought the joins would be pretty much like my other
rails apps where I do HABTM checkboxes. I''ve created a page that just
shows habtm checkboxes for the join and the updates are occuring for the
join but I''m
2007 Sep 17
8
DISTINCT?
This should be easy, but I''m stumped...
class X < ActiveRecord::Base
belongs_to :y
end
class Y < ActiveRecord::Base
has_many :x
end
The y table has a column names. The x table has a column value. I
want the list of values in x for the name "Location" in y. Yes, there
are many repetitions.
I can probably hack together an SQL statement to do this without too
much
2006 May 15
2
retrieving hashes key & values (ASAP)
Hi,
I want to retrieve the set of key & values which returns from a
stored procedure : connection.select_all "exec common.dbo.scr_lookupric
''AAP.N'' ".
The results i want to display in a view screen call result.rhtml.
Please help me out ASAP.
Thanks in advance.
joshua...
--
Posted via http://www.ruby-forum.com/.
2010 Nov 25
1
Execute SQL Stored Procedure in R
Dear all,
I would like R to retrieve a table resulting from execute sql stored procedures. What function can I use? Can RODBC do it.
I tried
channel1 <- odbcConnect("ptsecmstqa01-alpha")
query <- paste("execute DB.dbo.usp_test")
Data<- sqlQuery(channel1, query)
However, it returned blank.
Best Regards,
Suphajak Ngamlak
Equity and Derivatives Trading
Phatra
2012 Aug 13
10
Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)
Am interested in the new PATCH method that will be included in Rails 4, but
have a question/concern, and forgive me if I''m misunderstanding it.
So, if the request parameter _method is set to "patch", the update is
processed as a patch.
But, let''s say you have a model called Airplane and Airplane has a
collection of FlightCrewMembers which it