Displaying 20 results from an estimated 700 matches similar to: "Using primary key that is not named "id""
2006 Jul 20
4
Help with Rails and postgres with sequence numbers (global?)
Hello,
I am building an Rails applications that has to integrate an legacy
system (lxoffice) (schema at:
http://www.lx-office.org/uploads/media/DB_Schema_2.1.1_R_393_17_03_2005_.pdf).
They somehow use global ids (global for some tables). I can not change
the schema and still I want to use Rails to access it and not pure SQL.
When I try to insert a record I get the following message:
2006 Sep 01
2
Mrelation does not exists
Hello!
I''m having the following error:
RuntimeError: ERROR C42P01 Mrelation "subjects_users_id_seq" does not
exist Fnamespace.c L200 RRangeVarGetRelid: SELECT currval
(''subjects_users_id_seq'')
when I try to do:
subject= SubjectsUser.new(params[:subjects_user])
subject.save
The models:
class User < ActiveRecord::Base
has_one :last_entrie
has_one
2006 May 11
4
Legacy database problem
Hi
I am trying to use Ruby on Rails to work with an existing database. The
problem is that, all the table names begin with a captial letter (e.g.
Products). So I did the following changes
in environment.rb, I''ve added under # Include your application
configuration below
ActiveRecord::Base.pluralize_table_names = false
In class Product, I''ve added
set_table_name
2008 Nov 14
3
migration with data
Hi
I am using postgres and have two migration files like
001_create_categories.rb as
class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.column :name, :string, :limit=>80
end
end
def self.down
drop_table :categories
end
end
and 002_populate_categories.rb
class PopulateCategories < ActiveRecord::Migration
2006 Aug 08
2
Testing Inconsistencies - ruby works rake fails
I''m getting some very weird results when testing my system. If I run my
unit tests using => ruby \test\unit\<filename.rb> each of the tests
pass. If I run => rake test_units I get several failures, and they all
have to deal with the same issue. For instance I''m getting =>
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42P01
Mrelation
2007 Oct 18
4
Feeding the framework ?
Hi there,
Is it just me or do many other rspec / rpsec_on_rails users spend more
time than they would like feeding the framework ?
Don''t get me wrong, I love rpsec, but I seem to spend about 2/3 hours
per week hunting down rspec problems.
For example, today `rake spec:models` is broken. When I migrate, load
fixtures and run `spec -cfs` all is well. When I run `rake spec:models`,
2007 Oct 18
0
rake spec:models failing
Hi there,
I''m having trouble with `rake spec:models`. It''s failing on:
- 1 old rspec/rails project
- all new rspec/rails projects
But, it *is* working fine on my other (older) rspec/rails projects. All
projects are on rspec & rails 1.0.8, Rails 1.2.3, os X ppc
Here''s a fresh rspec/rails project with failing rake task
$ rails test_app -d postgresql
$ cd
2006 Mar 16
3
inserted_at seems buggy in production mode?
Hi,
I''ve got a table with an inserted_at column. When I insert a record it
automatically injects the current date/time, all is well.
Then when I insert a second record, it uses the exact same timestamp
that is used in the first record.
This behavior only seems to occur in production mode. When I restart the
server, the problem goes away but then immidetatly occurs again on the
2007 Apr 17
0
set_primary_key issue
Hi:
I am new to the ruby and rails. What I am tried to do is to create a
scaffold based on an existing table in a MS SQL Server database.
Before I used the set_primary_key method, edit and show does not work
in the generated code. Rails displayed the list of the records ok, but
can not determine the id for each record. Create a new record does
work properly, however.
After I used the
2006 Mar 15
1
Through method problems with custom foreign_keys
A person has a many company_branches and
A company_branch has many people.
This join is represented using a "contacts" table.
I am using a legacy schema so i am forced into using non-standard rails
primary keys. I am using the new through relationship in rails 1.1.
p=Person.find(1)
b=p.company_branches # gives this error:
ActiveRecord::StatementInvalid: OCIError: ORA-00904:
2008 Apr 06
1
Scrambling objects ID's for users
Hello. I would to replace a standard records idenfiers -
1,2,3,50043,43242 etc by a something like guid. I would like to use it
everywhere - in assocations, etc, because i don''t wont to user estimate
my database size by simple reading ids. Whats the solution? Is somewhere
a rails plugin (i use rails 2.0.2)? I have problem with standard
approach - by simple replacing id column by string
2006 Jan 18
3
legacy database on remote host
I''m getting this error in webrick then it crashes leaving nothing in the
log.
ruby: symbol lookup error:
/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:
mysql_sqlstate
Here is the standard query I would normally write to get the data.
select * from child,parent
where CONCAT(SUBSTRING(child.item_number,1,14,''00'') =
parent.order_number and
2005 Oct 05
0
has_and_belongs_to_many on legacy DB
I am working with mapping ActiveRecord onto a legacy database. All is going
well (using set_table_name, set_primary_key, etc), but I can''t get my
many<=>many relationships to work.
My contrived example of the situation:
Student has_and_belongs_to_many Teachers. This is mapped via table
student2teacher where the foreign keys are studentId and teacherId. The
primary key in Student
2006 Mar 09
2
turn off auto increment
Hello,
I have an old table that handles sessions. the primary key is a field
called session_id and is the actual session id like "8df838303ufdfu838"
however when i do the following in the model:
set_primary_key "session_id"
and the following in the controller:
@session_hash = { "session_id" => @session.session_id, "session_user_id" =>
2005 Jul 07
0
Migration: server with smb 2.2 -> new server, 2.2 too, weird issues
Hello all at the samba list.
The other day there was a migration of server; the old one had Samba 2.2
(.6) working normally. Every user logged in the domain without problems,
their SIDs and the domain SID were right, everything was ideal. But a
server update was needed, and a new server was installed, also with
Samba 2.2 (.12). The difference in version is not important this time as
other
2006 Jul 25
2
join in legacy DB?
I''ve got a problem with some tables that don''t follow any RAILS
standards. how do I define the join in the model when all three tables
have wacky names?
class Machine < ActiveRecord::Base
set_table_name "tbl_CodeMgmt_Host"
set_primary_key "Id"
end
class Pool < ActiveRecord::Base
set_table_name "tbl_CodeMgmt_Pool"
set_primary_key
2006 Apr 11
1
Foreign Keys
Hi,
My tables are as follows:
"tblusers" - primary key "TblUsersID"
"tblregisteredphones" - primary key "TblRegisteredPhonesID"
- foreign key "intUserID"
My models are as follows:
class Registeredphone < ActiveRecord::Base
set_table_name "tblregisteredphones"
belongs_to :user,
:foreign_key
2008 Jan 23
1
Making Parents object attributes available
Hello,
I have a class Person
class Persoon < ActiveRecord::Base
set_table_name "Persoon"
set_primary_key "p_persoon"
has_many :adres, :class_name => "Adres"
composed_of :name, :class_name => Name, :mapping => [ [:naam,:naam],
[:voornaam,:voornaam], [:voornaam2,:voornaam2],
[:persnickname,:persnickname], [:perssortname,:perssortname] ]
def
2017 Oct 14
0
Updating keywords on copy/move
Hello,
I'm working on my virtual keywords plugin [1] to add an apparently
simple feature: add a keyword to a message when it is moved or copied
into a virtual folder (let's forget about what keyword to add, I'm
starting with a hard-coded one to understand Dovecot plugin
development).
So I've added a mail_copy hook by the notify plugin [2] and did a
simple call to
2006 Feb 03
3
My associations are coming out nil.
I''ve got a fairly simple system with a table for my Users that
includes a CountryId field which looks up to the CountryId field of my
Country table. What I would like to happen is for my Rails
application, which contains models for both User and Country, to be
able to draw the dropdown list of available countries on the edit
page, like it does in all the tutorials.
My model classes look