Displaying 20 results from an estimated 10000 matches similar to: "composite keys and association"
2014 May 15
0
composite primary key - Rails 4.1
Hi,
I am facing issue with composite primary key
In my gem file I have the below entries -
gem 'rails', '>= 4.1.0.rc2'
gem 'mysql2'
gem 'rb-readline', "~> 0.5.1"
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'bcrypt', '~> 3.1.7'
gem
2006 Aug 14
0
Composite Primary Keys - now works with Rails 1.1.6
Due to the foolish implied assumption that there''d never be a revision
to activerecord library, the Composite Primary Key code promptly broke
for anyone who updated their apps to Rails 1.1.6 (with its
activerecord-1.14.4)
Now the gem dependencies are fixed and your legacy databases are free to
wield composite primary keys without fear again.
Description:
Composite Primary Keys
2006 Jul 30
0
Composite Keys 0.3.3
Composite Primary Keys for ActiveRecords
Bug fix release - 0.3.3
Notes:
Fixed errors with id= and create.
Note, the create method does not use sequences to generate ids for you.
If anyone has any use cases where their DBs generate ids for their
composite keys, pls let me know - we may need to add some syntax to the
set_primary_keys command.
Url:
http://compositekeys.rubyforge.org
Summary:
2006 Jul 23
0
Composite Primary Keys 0.3.2
ActiveRecords with composite primary keys now seem to happily support
find/create/update/destroy options.
Url: http://compositekeys.rubyforge.org
Background:
Rails/ActiveRecords has long been critised for not supporting legacy
databases, especially composite primary keys. This gem extends ARs with
this support.
Cheers
Nic
--
Posted via http://www.ruby-forum.com/.
2007 Mar 08
2
Composite Primary Keys
Have been looking into using rails but am finding the "Composite
Primary Keys are Bad" thing a tad disturbing (to put it mildly). I
have been working with RDBMS systems for over fifteen years and this
is the first time I have herd the idea questioned. I have cone across
using surrogate keys which mirror the composite key for performance
reasons in VERY big databases but I have never
2009 Jul 02
2
compose_primary_keys
I´m looking for a way to work with compose primary keys.
I alredy know that plugin http://compositekeys.rubyforge.org/
but it doesn´t have examples.
Please help =]
--
Horus Augustus C. C. Lima
Sagarana Tech
Mobile +55(85)8842.4402
Desk +55(85)3304.6530
augustus-b3GZhX+fmr6XmMXjJBpWqg@public.gmane.org
http://www.sagaranatech.com
--~--~---------~--~----~------------~-------~--~----~
You
2006 Jan 10
5
Select Tag and Associations
Hi there,
I''ve been working on this for awhile and have finally decided to ask
for a little guidance.I have a slight problem trying to save a
selection.
I have two models:
A "Posting" has_many "Categories", and a "Category" belongs_to one
"Posting". With that said, in the posting model I have "has_many
:categories" and within the
2009 Feb 20
6
How to mock an object defined in the before_filter function?
Hello,
I am trying to implement the following scenario, but I am stuck ...
The thing is I want to initialize a variable @comment when the stub
function "find_comment" is called.
The way I do it below doesn''t work, since
"before_filter :find_comment" returns true/false and @comment
initialization is done inside it. Could you please give me a hint how
to do it?
One
2006 Jun 03
6
Calculating row COUNTs
hi everyone,
I''m trying to do a simple calculation in my rails project. I would like
to find all rows in a table that match the given id of another table
(ie. comment_id) and has the value = 1 ("value" is a field in the
table), then add those values up. Next find the same rows with the
value = -1 and add those values up also. Finally, I would like to find
the total.
2012 Apr 10
6
User Association
Please Im trying to create an application where i can post like twitter,
but i was the users name to be posted under their respective posts
My Post_controller looks like this
def index
@posts = Post.all(:order => "created_at DESC")
@users = User.find(:all)
#@user_id = current_user.find(params[:id])
respond_to do |format|
format.html
end
end
def create
2011 Nov 02
3
form_for text_field
I have a form
... html .....
<% form_for @person do |f| %>
... html .....
<%= f.text_field :last_name %>
... html .....
<% end %>
When last_name field of @person doesn''t contains french special symbols
like ''é'', all characters are displayed in the input control
(f.text_field :last_name ).
Else only symbols before french special symbol are
2006 Jul 26
15
Rails without a primary key
I''ve been trying to use Rails on a database where the biggest
datawarehouse-style table doesn''t have a primary key. It really
doesn''t make sense and just adds extra unnecessary space. I do have,
however, a column that I normally use to search on (IP) that returns
many rows. The table also references several other tables through
rails-friendly foreign keys.
Simple AR
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
I''ve got User has_one Shop. Rails is not validating when I tried
create_shop or build_shop, neither in the browser nor the rails console.
My code:
class Shop < ActiveRecord::Base
attr_protected :user_id
belongs_to :user
validates_presence_of :name, :primary_address, :city, :country_code,
:currency
end
class ShopsController < ApplicationController
before_filter
2006 Aug 02
0
Composite Primary Keys support for Associations
Announcement:
Composite Primary Keys gem now includes support for ActiveRecord
Associations.
Summary:
Composite Primary Keys allows an ActiveRecord to support 2+ primary keys
using the set_primary_keys class method. Previous versions provided full
CRUD and find support. This latest release provides support for more
ActiveRecord magic: associations (has_many, belongs_to, etc)
Full report:
2010 Jan 27
2
has_many, through with nested models?
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => ''created_at
desc''
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
belongs_to
2013 Jul 19
12
Rails 4 "belongs_to: record" association doesn't work
Hi,
I discovered a weird behavior when using a "belongs_to: record" association
in Rails 4.
Given two models A and B:
class A < ActiveRecord::Base
belongs_to :record, class_name: ''B'', foreign_key: ''b_id''
end
class B < ActiveRecord::Base
end
When creating A, it inserts a record in B and returns A with id of nil:
irb(main):001:0>
2009 Mar 09
3
multiple columns primary key
Hi all,
I have two tables:
TABLE 1
A pk - fk (referencesc TABLE 2)
B pk
C pk
D pk
E
F
TABLE 2
A pk
G
H
I
L
I don''t use incremental field (id). I''d like don''t use find_by_sql.
How can I define both models to use correctly find method (with
include)? With only one column primary key I haven''t problems.
I thought two solutions, but I don''t like these
2006 Feb 08
1
Handset phone to replace Flash Operator Pane l
Breeze to set up, too. To monitor and transfer to SIP/1000 / ext 1000:
1. Insert exten => 1000,hint,SIP/1000 into your default context (the context
the extension is in)
2. In the monitoring phone's web interface, click Function Keys, pick a key,
change it to Destination and type in SIP/1000. Once you submit the form it
will change to a SIP URL, that's OK.
3. There is no step 3.
2007 Jun 03
3
Contextual Associations
No doubt this has been covered but I''ll be damned if I can find it.
References appreciated so I can add to my library.
1. I have 3 tables in my problem: changes, environments, comments
2. changes are many-to-many to environments
3. changes has-many comments
Here''s the tricky part:
4. environments has-many comments dependent on the current
environment.
Tables:
changes,
2007 Nov 12
7
schema_info always wants to be 3, even when set to 7
Hi all,
I''m having a very odd problem with db:migrate. I''m using Rails 1.2.5
on Windows XP SP2 and Ruby 1.8.6
I have seven migrations. If I run them with an empty database, it
runs the first three, then halts. When I look in schema_info, the
version is 3.
If I run db:migrate VERSION=7, then it runs through the remaining 4
migrations, and the version is 7 in the DB.