Displaying 20 results from an estimated 8000 matches similar to: "Questions about ActiveRecord"
2010 May 14
4
Tricky model situatione
I have two models Club and users. users are regular authenticated
users and some of them might create a club. A club can also have
members (essentially users) and there are attributes and models that
apply to member but not to users.
Here is what I have right now.
Club => belongs_to :user
User => has_many clubs (since a user can host multiple clubs).
Now how do I fit this member model
2006 May 14
3
Strange Database Mapping Question
Dear Rails List,
I am new on the list so will assume straight away that this question has been
answered before. As I can see no immediate way of searching the list, I will
ask the question. I apologize in advance for any disruption this may cause.
Question time:
I am trying to write a web application for the staff at my office to play a
form of virtual Super14. Its a bit like any of the
2007 Oct 16
8
Using multiple foreign keys in views
I have a model, Game, that has_many :teams. There''s a home team and an
away team. I created two foreign keys, so each game can have two teams
associated with it. Here''s the Team model:
class Team < ActiveRecord::Base
belongs_to :game,
:class_name => ''Game'', :foreign_key => ''hometeam_id''
belongs_to :game,
:class_name =>
2006 Apr 11
5
Multiple "has" in ActiveRecord
Please excuse a newbie question, but I couldn''t find anything by
searching the archives.
What I want to know is how to have multiple references to the same
class/table within a class. For example, let''s say I have a table called
People:
create table people (
id serial8 primary key
,name);
which just holds a list of the people in the database. Then I have
another
2018 Nov 19
1
[PATCH] v2v: -o openstack: Option to add --insecure flag to openstack command.
If ‘virt-v2v -oo insecure’ is used then ‘openstack --insecure’ flag is
added whenever we invoke the openstack command. This turns of SSL
certificate validation.
---
v2v/output_openstack.ml | 14 +++++++++++++-
v2v/virt-v2v-output-openstack.pod | 1 +
v2v/virt-v2v.pod | 7 +++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/v2v/output_openstack.ml
2008 Jan 27
4
(REST) Nested routes
Hello, I''m in troubles with nested routes. I have three models: Team,
Tournament and TeamTournaments
class Team < ActiveRecord::Base
has_many :tournaments, :through => :team_tournaments
has_many :team_tournaments
class TeamTournament < ActiveRecord::Base
belongs_to :team, :foreign_key => ''team_id''
belongs_to :tournament, :class_name =>
2006 Mar 07
13
Active Record - Can''t figure out relationship.
I have the following two tables:
create table teams (
id int not null auto_increment,
short_name varchar(12) not null,
long_name varchar(50) not null,
logo varchar(20) not null,
primary key (id)
);
create table rounds (
id int not null auto_increment,
home_team_id int not null,
away_team_id int
2018 Nov 20
0
[PATCH v2] v2v: -o openstack: -oo verify-server-certificate=(true|false) (RHBZ#1651432).
If ‘virt-v2v -oo verify-server-certificate=false’ is used then
‘openstack --insecure’ flag is added whenever we invoke the openstack
command. This turns off SSL certificate validation. The default is
to verify the server certificate (which is the default of the
openstack command).
---
v2v/output_openstack.ml | 16 +++++++++++++++-
v2v/test-v2v-o-openstack.sh | 2 ++
2005 Jan 31
0
(no subject)
Sender: EMBROIDERED <tsl2u.c0shr@myweb.cn>
Reply-To: meilung1931@yahoo.com.tw
Date: Thu, 16 Dec 2004 12:08:13 +0800
X-Mailer:Dynamailer V 8.4
X-MimeOLE:Produced By Mircosoft MimeOLE V6.00.2600.0000
Return-Path:meilung1931@yahoo.com.tw
[r-devel@stat.math.ethz.ch ]
EMBROIDERED PATCHES CUSTOM POLICE , FIRE, SPORTS , CLUBS
2007 Feb 24
0
after_create not creating the right object
I have 2 tables... club and forum, which use the "type" as I''m
subclassing the Club and Forum objects. Tables are:
clubs:
id
title
type
forums:
id
club_id
title
type
I''ve put an "after_create" callback in the Club as Club has_one Forum:
class Club < ActiveRecord::Base
after_create :create_forum
has_one :forum
def self.create_forum
# create it
2006 Jun 04
6
Activerecord relations.
I''ve got two tables set up - Things and Users where Users have many
things and Things belongs to Users.
They''re connected by Things.user_id => User.id and Things.updated_by_id
=> User.id both in the Things model using Belongs_to and custom foreign
key for one of them.
Problem is when I''ve got the updated_by_id belongs_to I can''t add Things
using
2007 Jun 13
6
ActiveRecord query using association
Hello all,
I apologize if the answer to this question is going to be rudimentary,
but I am thus far stymied by the information I have found on the web.
This seems like it should be simple, but I haven''t really found an
example of how to do this yet.
I have a model called Account which has a belongs_to reference to
another model, User, as below:
class Account < ActiveRecord::Base
2006 Nov 27
3
ActiveRecord: Reference same table twice
Hi,
I have 2 tables, "users", and "user_comments". I am trying to allow
users to leave comments on each other''s profiles (eg, think youtube like
this: http://www.youtube.com/profile_comment_all?user=google).
Here is a simplified view of my database schema:
mysql> describe users;
+-----------------+--------------+------+-----+---------+----------------+
| Field
2009 Jul 29
5
[newbie] double relationships in database
I have the following tables
teams
id :string
name :string
and
matches
id:
home_team :team_id
visitor_team :team_id
how can I reflect that kind of relationship in a RoR model?
thanks and keep up the good work.
2006 Jul 29
1
creating and storing records in Ruby
I''ve read through my RoR books and I can''t seem to find the solution.
This is a pretty basic, easy, and practical application for RoR. If you
guys know of any resources on the net to answer these questions let me
know.
Question 1:
Basically, I have a many-to-many relationship that I want to add records
to. I use something like this to add records in the A_B table:
2008 Mar 07
2
Trouble using RESTful helper
Hi,
I am trying to get into this REST thing, I have a nested resource
whith the following route:
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :clubs do |club|
club.resources :members
end
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
end
Everything worked ok for this
2013 Jun 22
4
ActiveRecord::Base.transaction - SystemStackError - stack level too deep:
Im having an issue that seems to only happen when trying to use a
transaction. Ive used transactions many times in the past and Im at a loss
as to why im getting the stack level too deep problem.
SystemStackError - stack level too deep:
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:70:in `''
I have a StackOveflow with more detail -
2006 Jul 06
2
Custom init. of ActiveRecord objects - best practices
All,
I''m wanting to initialize an ActiveRecord object.
I understand that there is a method called after_initialize that appears
to get called right after the ActiveRecord object is instantiated.
Is after_initialize a Ruby thing or a Rails thing?
Where is after_initialize documented?
Can I pass parameters to it? If so, how?
I want to initialize the "belongs_to" attribute of
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 09/13] lguest64 devices
plain text document attachment (lguest64-device.patch)
We started working a little bit on the devices for lguest64.
This is still very much a work-in-progress and needs much more work.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Glauber de Oliveira Costa <glommer@gmail.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Index:
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 09/13] lguest64 devices
plain text document attachment (lguest64-device.patch)
We started working a little bit on the devices for lguest64.
This is still very much a work-in-progress and needs much more work.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Glauber de Oliveira Costa <glommer@gmail.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Index: