Displaying 8 results from an estimated 8 matches for "table_name_with_underscor".
Did you mean:
table_name_with_underscore
2007 Oct 16
2
Primary Keys enforcement vanishes in test database
I use this naming convention for primary keys:
ActiveRecord::Base.primary_key_prefix_type
= :table_name_with_underscore
I generate the MySQL test database: rake db:test:prepare, and although
the column is there there is no primary key enforcement/index and no
autoincrement (so activerecord saves fail). Is this a bug? What is
the best workaround?
Alan
--~--~---------~--~----~------------~-------~--~----~
You r...
2005 Aug 06
2
Problem with 0.13.1 ActiveRecordStore with PG 8.0.3.
Hi,
I put the following in my environment.rb file:
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update
(:database_manager => CGI::Session::ActiveRecordStore)
Runnning WEBrick via "script/server" and trying to load any page
served by a controller results in an error like the following:
#<ActiveRecord::StatementInvalid: ERROR: null value in column "id"
2005 Jan 28
16
primary_key_prefix_type, support for non-integer primary keys
...couple of questions regarding primary_key_prefix_type and
non-integer primary keys.
I see in the ActiveRecord documentation [1] that by default the primary
key of a table "foo" is expected to be "id", though
primary_key_prefix_type this can be changed to :table_name or
:table_name_with_underscore for "fooid" and "foo_id" respectively. I''m
unclear where to set this or the syntax I should use. My attempt has
been to add code to environment.rb things such as
ActiveRecord::Base.primary_key_prefix_type :table_name_with_underscore
or
def
ActiveRecord::Bas...
2006 Apr 20
5
Integrating with Legacy Databases
...(Rails Recipes, from PragProg, by Fowler) they deal
with integration with a WordPress db where all field names are
preceded by "comment_" -- i.e. comment_author_email.
The recipe explains how to deal with the primary key (comment_id) via:
ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore
which is great: the primary key would obviously be the most important
piece to get working :)
However, it stops short of going into detail on dealing with this on
the other column names.
I guess what I''m looking for is a nice clean way to take their extent
their example - allowing me t...
2008 Apr 08
1
Help with primary_key_prefix_type
I put this config in environment.rb
# Use table_id instead of id for primary key.
config.active_record.primary_key_prefix_type =
:table_name_with_underscore
I have this migration:
class CreateEntities < ActiveRecord::Migration
def self.up
create_table :entities do |t|
t.string :entity_name, :null => false,
:limit => 40
t.string :entity_legal_name, :null => false,...
2006 Feb 27
4
2 belongs_to to the same parent table
Hello!
I have 2 table: users and buddies
User: id, name, ...
Buddy: id, user_id, user_buddy_id, ...
So if you have 2 users 1,jack and 2,fred and fred is a buddy of jack,
there is a Buddy object: id=1, user_id=1, user_buddy_id=2
I can declare only one belongs_to in Buddy and one has_many in User. And
there is conflict if I had the second one (the first one is discarded)
class User
has_many
2005 Aug 08
7
Problems with ./scripts/generate scaffold
Hi all,
I''m new to rails after having used perl for most of these things, and am
trying to get my head around the generate script for a project playing
around
with.
If I do:
./scripts/generate controller Device
I get app/controllers/device_controller.rb
where I can then add:
scaffold :device
However, if I want to actually generate the scaffolding so I can make
some changes:
2005 Aug 08
68
Pluralized Controller Names?
If I do:
script/generate controller Photo
I get a controller named photo_controller. OTOH, if I do:
script/generate scaffold Photo
I get a controller named photos_controller. (Note that the controller
name is pluralized).
I realize that I''m specifying the controller name explicitly in the
first case, but it seems
odd to me that the scaffold command generates a pluralized