Displaying 20 results from an estimated 3000 matches similar to: "Trying to display data from two tables"
2006 Mar 15
10
Scaffold with Foreign Key
I have two tables:
------------------------------
drop table if exists users;
create table users (
id int not null auto_increment,
username varchar(100) not null,
password varchar(20) not null,
firstname varchar(20) not null,
lastname varchar(20) not null,
primary key (id)
) TYPE = InnoDB;
------------------------------
drop table
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
2010 Dec 14
4
Change primary_key column name
Hi,
after changing a primary key column name, the auto-increment information
(MySQL) and sequence (Oracle) are lost. What is the correct way to rename
primary keys?
Thanks,
Gustavo
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Jul 13
5
Relationships: one model referencing same table for different data sets?
Hi,
After I''ve saved, I want to display the Description from the Codes table that
corresponds with the ID in the Cause table.
Rails doesn''t seem to like that, because on my form, I have two sets of data in
combo boxes that come from the Codes table. So, in the show template, I can''t
do this:
Cause of Death: <%= @cause.code.description %>
Any ideas?
The
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers -
I''m trying to add to a collection through HABTM, but the sql
insert is trying to insert a PK rather than letting mysql produce the
auto_increment''ed PK.
## @medication_dose holds a validated, saved model
@medication_dose.medication_frequencies << MedicationFrequency.find
(:all)
The above bails with,
Mysql::Error: #23000Duplicate
2012 Jan 09
2
create table in mysql using asterisk
Hi,
I try to create a new table using MYSQL command in asterisk.
This is what i write:
Query resultid ${connid} CREATE TABLE IF NOT EXISTS "conference_600"
("id" int(11) NOT NULL auto_increment, "channel_id" varchar(40),
"number_in_line" int(2), PRIMARY KEY("id")")
and this is the warning that i get in the cli:
app_addon_sql_mysql.c:383
2006 Mar 09
4
habtm questions
I''ve got some of this working but other parts are ellusive.
I have
CREATE TABLE `bags` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '''',
PRIMARY KEY (`id`)
CREATE TABLE `packages` (
`id` int(255) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '''',
PRIMARY KEY (`id`)
CREATE TABLE
2006 Apr 28
9
Q: Timing of render :update in an action ?
Hey folks, am hoping someone can set me straight with a solution to an
issue that has come up involving the timing of rendered page elements in
relation to the completion of an action''s execution.
I have an ror search app which searches through two tables consisting of
7,000 page urls and a table w/ 87,000 related keyphrases within those
pages. Search results can take anywhere from 2
2009 Aug 31
3
Migration - wrong SQL statement is created
Hi,
I am doing my first steps with RoR and I have the following problem:
I execute my migration file with the following content on a
MySQL-database via Rake:
<code>
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.integer :id
t.string :username, :size => 100
t.string :password, :size => 100
t.string :email, :size
2006 Jun 27
1
Help me, I stuck ..
I have three tables and is not allowed to change data scheme:
CREATE TABLE `applicants` (
`id` int(10) unsigned NOT NULL auto_increment,
`fullname` varchar(60) NOT NULL default '''',
`address` varchar(60) NOT NULL default '''',
PRIMARY KEY (`id`)
) ;
CREATE TABLE `positions` (
`id` int(10) unsigned NOT NULL auto_increment,
`position_name` varchar(30)
2006 Oct 31
4
Auto-increment lost during migration.
Hi. I get some strange results when using rename_column on a primary
key in a migration. It seems like the migration script removes the
auto-increment property if you rename a column.
This is a minimal example.
create_table :foo, :primary_key => :foo_id do |t|
t.column "name", :string
end
# renaming the primary key makes auto-increment disappear.
rename_column
2005 Sep 13
5
acts_as_taggable 1.0.4 now gemified!
Hi Folks,
The acts_as_taggable mixin is now available as a shiny gem.
More details here:
http://dema.ruby.com.br/articles/2005/09/13/acts-as-taggable-gemified
This release features some cool additions as well.
Cheers
Dema
--
http://dema.ruby.com.br - Rails from a .NET perspective
2015 Jul 06
4
CDR in an MySQL-Database
Hi list!
I'd like to save all information about calls (CDR) in a MySQL-Database.
I created the DB and a user for Asterisk on a separate server, then I
configured my cdr_mysql.conf so:
[global]
hostname=192.168.10.3
dbname=asterisk
table=cdr
password=MYSECRET
user=asterisk
port=3306
and my cdr.conf so:
[general]
enable=yes
unanswered = yes
safeshutdown=yes
[mysql]
usegmtime=no
2005 Aug 11
5
Realtime + MYSQL
I'm having a few issues with the MySQL realtime configuration in
CVS-HEAD. I tested it initially with realtime extensions (realtime_ext
=> mysql,asterisk,extensions) and a realtime switch in extensions.conf
and that works fine, So I though I'd go back and test a static
configuration mapping.
I used the table structure from the asterisk guru postgres howto to
create something
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
Hi everyone,
I''ve tried posting the same question to the list last Friday but
somehow did not see it being posted..
I''ve just started with Rails and Ruby. I just started to play one of
those RPG and to get my feet wet I''m writing an app to keep track of
item fusions. So the scoop is that item can be fused with another
items to create a higher level item. The higher
2005 Jul 05
2
Salted hash login generator (verification problem?)
Hi all,
I hope someone can help with what is probably a simple newb
installation mistake on my part. I''m having a couple of problems with
the salted hash login generator. I installed it following the
quickstart guide, and the unit tests work like a charm. There are two
errors and a failure on the function tests, though; the verified field
seems to be involved in at least one of
2006 Jan 04
4
Need some implementation ideas :-)
Hi,
I have good this cool challenge from my boss on developing a very simple
cms-like system to publish articles within. The caveat is that he wants
to have multi-lingual content.
At first I thought RoR would be perfect for the assignment but right now
I''m not so sure.
My first attempt involved creating a table for each model/languagde like
this:
articles_en
articles_dk
articles_de
2006 Aug 02
2
many-to-one relationship, do I need a second table?
Ok, to keep things short. Im wondering if I need a secondary
relationship table to handle my many-to-one relationships. Here is an
example of what I''ve written down. For instance say I want to find all
of the people in a given location.
class Location < AR:Base
has_many :people
end
class Person < AR:Base
belongs_to :location
end
My SQL tables look like:
CREATE TABLE
2005 Dec 15
4
rake migrate ignores '':null => false'' on mysql
I wanted to add a login string column to an existing table
=> I created a migration :
...
def self.up
add_column "members", "login" , :string, :null => false
end
...
remark: it shouldn''t work, as the table is not empty (=> ''login'' would
be null in the existing rows.)
problem:
rake migrate didn''t complain
2005 Sep 02
7
Form to update two tables
Hello there,
this is probably a very simple problem but I''m stuck.
I''m following the Login generator tutorial from rubyonrails. It''s all
worked fine so far. But I want to add a bit more functionality so that
when a user signs up in addition to chosing a login name and password
they type in a company name which is added to a seperate table called
COMPANIES. The id