Displaying 20 results from an estimated 400 matches similar to: "ActiveRecord and refreshing column info"
2018 May 02
0
Merging dataframes
Hi,
I'll coded your example into R code:
Table_A <- c('abc at gmail.com', 'John Chan', '0909')
Table_A <- rbind(Table_A, c('bcd at yahoo.com', 'Tim Ma', '89089'))
colnames(Table_A) <- c('Email', 'Name', 'Phone')
Table_A
Table_B <- c('abc at gmail.com', 'John Chan', 'M',
2006 Mar 21
0
Nested One-To-Many ActiveRecord Question
I have a set of one-to-many relationships, nested 4 deep. In other
words:
table_A has_many table_B,
table_B belongs_to table_A, has_many table C,
table_C belongs_to table_B, has_many table D,
table_D belongs_to table_C
Now, I want to to find on table_A, based on criteria in table_D, and
I want to paginate it. And I need fields from all four tables in the
result set.
Does anyone know
2010 Aug 19
1
Composite primary keys and :joins=>
I have a legacy db with the following simplified structure:
Table-A:
type_key, code_key, name, ... # PKs are type_key and code_key,
there is no id col and I cannot alter this db
Table-B: # each row has only the code as a foreign_key, the type_key
is hard-coded to "FOOKEY"
an_id, code, ...
Models:
class TableB < AR::Base
set_table_name ''table_b''
2006 Mar 15
4
help with DRY violation
I''m trying to be a good rails developer and fix DRY violations as i find
them. However, i''m trying to fix this one, i cant seem to get it to work.
I have two tables A and B that have a one-to-one relationship. Table B
belongs_to Table A. Table A has_one Table B. I''m creating instances of
Table A in different places, depending on the controller. However, for each
2006 Aug 15
1
sorting attribute in list from foreign table
Hello, I currently have two tables.
table_a (
id
table_b_id
other_attrs
)
table b (
id
name
)
So table A holds an id from table B. During the listing of tuples in
table A, it lists table A''s attributes. In place of the table B id, I
check the id, and instead display the name corresponding to that id. Now
I want to be able to sort the listing of tuples in table A by the
2018 May 02
2
Merging dataframes
Thanks - Peter, Eivind, Rui
Sorry, I perhaps could not explain it properly in the first go.
Trying to simplify it here with an example - Say I have two dataframes as
below that are NOT equally-sized data frames (i.e., number of columns are
different in each table):
Table_A:
Email Name Phone
abc at gmail.com John Chan 0909
bcd at yahoo.com Tim Ma
2018 May 02
0
Merging dataframes
Thanks, Peter, Eivind and Lui
Sorry, I could not explain it properly in the first go. Trying to simplify it here with an example - Say I have two dataframes as below that are not equally-sized data frames:
Table_A:
Email Name Phone
abc at gmail.com<mailto:abc at gmail.com> John Chan 0909
bcd at yahoo.com<mailto:bcd at yahoo.com> Tim Ma
2006 Jan 26
0
If you want to disconnect a database properly, there is the code:)!!!
Hi,
We have worked on a problem of connection: Connect to
two databases with a single ActiveRecord::Base model
class within the same action
The main difficulty is how to disconnect the actual
connection properly and then let the ActiveRecord
establishes a new one.
The actual function "remove_connection" removes the
connection, but its doesn''t unbind the link between
rails and
2006 Jan 11
0
Connection problem with a generic-runtime-built ActiveRecord::Base
Hi,
I''m trying to create a "runtime-generic" ActiveRecord
class, It means I don''t need to know the table or
database, before I create my program ruby-rails. So I
don''t need to predefine my database in environment.yml
file and pre-build classes inherited from
ActiveRecord::Base.
I write some code, it seems to work. However, I can''t
disconnect my
2006 May 31
0
belongs_to without referencing an id as a foreign key?
Hello everyone,
Here''s my problem for the day: I have three tables that look a little like
the following
table_a
id
table_b
id
position
table_a_id
name
table_c
id
table_a_id
table_b_position
There will be many rows in table_c that have the same table_a_id, and the
same table_b_position. These will all be referencing the same name value in
table_b. The row in table_b may
2012 Jun 14
1
readHTMLTable function - unable to find an inherited method ~ for signature "NULL"
Hi R experts,
I have been playing with library(XML) recently and found out that
readHTMLTable workls flawlessly for some website, but it does give me an
error like below
... Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "readHTMLTable", for
signature "NULL"
let's say..for example, this code works fine
a
2005 Dec 20
7
wrong id for activerecord object when using :joins in mysql
I''m using a find with a :joins clause, like this:
:joins => "JOIN table_b ON table_b.id=table_b_id"
The records returned are used in a scaffold generated list page. The edit,
show, and destroy links are getting the wrong id. They are getting the id of
the table b record.
When I run the query using mysql, I see that the query returns *2* id
columns, the id of the main
2006 Jan 03
3
Can I map 2 tables into one class
Can I map 2 tables into one class?
Is there any pattern, e.g. using ActiveRecord aggregation?
Thanks
Szczepan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060103/fa2aed7c/attachment.html
2007 Mar 15
5
rake spec:views no transaction error
Hello,
I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving
the following message with each view spec execution:
WARNING: there is no transaction in progress
I have upgraded the rspec_on_rails plugin as well, and both the model and
controller tests are working flawlessly. Is there some simple step I
missed? thanks for the input.
-Chris
-------------- next part
2009 Feb 25
1
Problem with set_table_name
Dear friends,
I ran the following in my console.Assume I already have the
postgresql connection .
>> class D < ActiveRecord::Base
>> end
=> nil
>> D.set_table_name "users"
=> nil
>> D.column_names
=> ["id", "name", "fname", "lname", "password", "addr1", "addr2",
2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table
has another "non-joiny" attribute.
I went from this:
has_many_and_belongs_to :jobs, :join_table => ''tablename'',
:foreign_key => ''x'',
:association_foreign_key => ''y''
to this:
has_many :jobs, :through =>
2005 Dec 15
1
migration: counter cache & "reset_column_information"
To speed up
<%= @project.members_count %>
, I added a counter cache to the ''projects'' table with the migration
below:
def self.up
add_column "projects", "members_count", :string, :default => "0"
Project.reset_column_information
Project.find(:all).each do |p|
p.update_attribute :members_count , p.members.count
2006 Jul 12
2
Weird problem. How to tell if an attribute has changed? Please help.
How do you tell if an foreign key attribute has been changed?
For example, lets say you have a model with attribute table_a_id.
Would you do this?
def table_a_id=(value)
if value != table_a_id
@table_a_changed = true
write_attribute ''table_a_id'', value
end
end
def table_a=(value)
if value != table_a
@table_a_changed = true
2003 Jan 07
2
[Bug 127] PAM with ssh authentication and pam_krb5 doesn't work properly
http://bugzilla.mindrot.org/show_bug.cgi?id=127
------- Additional Comments From djm at mindrot.org 2003-01-07 17:13 -------
This fix is incorrect - the creds (which are often supplemental groups) need to
be restablished after initgroups(), which we call elsewhere.
Does the PAM module not support restablishing credentials?
------- You are receiving this mail because: -------
You are the
2006 Jul 14
3
Migration not updating fields
So I have this fairly basic migration bit of code
class AddCounterCache < ActiveRecord::Migration
def self.up
add_column ''products'', ''backlog_items_count'', :integer, :default =>
0
end
def self.down
remove_column ''products'', ''backlog_items_count''
end
end
What I want to do in that is automatically