Displaying 20 results from an estimated 2000 matches similar to: "rails3: t.index in migrations not working anymore"
2006 Aug 02
2
mangle ActiveRecord
Dear Gurus on Rails!
How do I change the behaviour of one method in
ActiveRecord::ConnectionAdapters::SchemaStatements ?
Full story:
I''d like to mangle
ActiveRecord::ConnectionAdapters::SchemaStatements
so when it creates a new sql table, it also (optionally) creates my
created_at, deleted, key_id, session_id etc columns that I use on basically
all tables.
It would not be DRY to repeat
2008 Feb 26
5
Rails 2.0.2 MySQL 'year' datatype missing from ActiveRecord?
Hi all,
This is my first post to the forum, and I''ll point out right away that
I''m a noob to everything, Ruby, Rails, MySQL, etc., so I expect that I''m
wrong here, but is the ''year'' datatype missing from ActiveRecord in
2.0.2? According to my MySQL 5.0 reference manual, ''year'' is a datatype,
but when I try to run a migration that has
2006 Feb 26
1
Migrations: column option "offset"?
Hi,
On the wiki
http://wiki.rubyonrails.com/rails/pages/UnderstandingMigrations it says:
Valid column options are:
- limit
- offset
- null (i.e. ? :null => false? implies NOT NULL)
- default (to specify default values)
I was wondering what the purpose of the "offset" option is. And after
looking at the API at
2010 Aug 08
0
registerable method undefined in Devise migration (was Re: Re: No route matches)
On 8 August 2010 23:39, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> I tried to make the application from scratch again, and
> notices that I get the following when I run: $ rake db:migrate
>
> (in /Users/abder/Desktop/Rails/auth)
> == DeviseCreateUsers: migrating
> ==============================================
> -- create_table(:users)
2009 Sep 28
5
Multi-databases support
Hi,
While I was hacking ovirt-server, I have found that it's currently
restricted to Postgres DB. Even if I like postgres for serious work on a
server, I really prefer to hack/dev locally on a Sqlite or MySQL DB.
I have googled on rails in order to find a good answer for the "foreign
key problem" which forces OVirt to stay on pg. I have found a plugin on
this particular
2006 Apr 19
6
undefined method `create_table'' for #<LoginController:0x5e60
I am geeting the foolowing error.
undefined method `create_table'' for #<LoginController:0x5e60110>
I wrote the crete action in application controller.
I am coping ther total worng please help me!
class ApplicationController < ActionController::Base
model :cart
model :line_item
before_filter :authorize
def create
# create_table() yields a TableDefinition instance
2006 Apr 17
7
MySQL backticks and column names
The upgrade to Rails 1.1 hurt my ability to run tests because it
generated the following MySQL error:
Mysql::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near ''key ON config (key)'' at line 1: CREATE UNIQUE INDEX key ON
config (key)
I have a table called `config` with a column
2006 Jul 05
5
Help with migrations and create
After creating a table in a create table migration, I''m then attempting
to populate a couple of rows of data in the table using the create
method. The first row gets inserted into the database, but any further
calls generate a select against the database, but no insert.
Am I doing something wrong, or is it inappropriate to create more than a
single row of data in a table using
2006 Mar 20
1
Migrations with multi-column indexes
Hey Folks,
I can''t really glean this from the documentation.
Is there a way to do: add_index(table_name, column_name, index_type)
within my migration for an index that spans multiple columns? Ie: A
covering index on FIRST_NAME, LAST_NAME or something like that?
Best,
Brian
---------------------------
Brian Corrigan
---------------------------
2007 Sep 27
2
How specify size of string column in a migration
I am new to RoR. How do you specify the size of a string column in a
migration? The examples I''ve see are all of the form:
t.column :name, string
which produces a VARCHAR(255). I want a VARCHAR(40).
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to
2007 Nov 14
6
a few add_index questions..
on previous apps i hadn''t really worried much about adding foreign key
indexes on my tables just because they''ve been fairly small and i
didn''t really think i needed them.
well, i''m working on something now that has the potential to have a
lot more data, and a lot more foreign keys.
so i have 3 tables... users, projects, and tasks.. should i be using
add_index
2009 Sep 04
12
Changing cursor while waiting for remote function response?
Hello,
Google and the search function didn''t help me this time. Is it possible
to change the mouse cursor while waiting for a response of a remote
function call?
--
Posted via http://www.ruby-forum.com/.
2012 Mar 02
2
Change DB data type and limited decimals
Rails3.1.3
I have db type,
startp:integer
I need to change it to float. More specifically,
1.2, 45.1, 143.8 ...
I have two questions:
1. Is removing and adding the field through migration the only way?
in other words, is there a single command to change the type?
2. Is there anyway to limit the decimal place to only one?
56.3, 34.2... are acceptable, but 23.112, 77.34, ... are
2006 Apr 02
2
rails db indexing and through association
Hello,
Say, I have a pictures table, and there are many objects which can have
pictures, so I define a picturable type. Now, to make the query for pictures
more efficient I should index the picture table using both picturable_type and
picturable_id.
Is this the correct approach to indexing the table, or can things be done
better? I want the database retrieval operation to be extremely fast (I
2006 Apr 30
4
Migration, BigInts, and string lengths
Howdy Y''all,
I was thrilled to recently discover migrations, as that framework
addresses a common problem in an elegant way. I have, however, gotten
tripped up a bit as I''ve worked with them.
The first problem I encountered was that, though I was using a BigInt
data type in a field in my dev database, my unit tests were failing
because when I copied the schema from the dev
2009 Mar 28
10
Use fixtures within fixtures?
Heya,
I''m using globalize2 and have following problem with my fixtures:
categories.yml:
one:
parent_id: two
color: #ff00aa
two:
color: #00ff11
three:
parent_id: two
color: #ab00ab
category_translations.yml
one-en:
id: one
locale: en
name: Cars
one-es:
id: one
locale: es
name: Coches
two-en:
id: two
locale: en
name: Start
two-es:
id: two
locale: es
2009 Mar 25
6
Hash with key and value from ActiveRecord?
Heya,
I think I have thinking barrier. I just want a simple hash out of an
ActiveRecord.
@attributes = Attribute.find_all_by_character_id(@character).hash {
|u| [u.name, u.value] }
and I would like to access it like
@attributes[:health]
but it doesn''t work. Anyone can help me out with that?
--
Posted via http://www.ruby-forum.com/.
2006 Jun 05
5
adding habtm through migrations
Hello,
I''m stuck, I''ve got a model Product and would like to add a new model
called Category. Furthermore, I want to set up a many2many
relationship between the mentioned models. the problem is that I do
not know how to set the primary key in the categories_products table.
this is what I''ve got in my migration file:
create_table :categories do |t|
t.column :name,
2006 Aug 08
2
Problem with plurals, migrations?
Hi,
Ruby 1.8.4
Rails 1.1.4
Windows XP Pro
I''m hitting an issue with migrations that I suspect relates to
pluralization. Here''s the migration:
class Hardware < ActiveRecord::Migration
def self.up
create_table :hardware do |h|
h.column :vendor, :string, :limit => 32
h.column :model, :string, :limit => 32
end
2010 Sep 13
10
Could not find [GEM] locally or in a repository
Hey Guys,
How could I fix the following:
"gem install --no-rdoc --no-ri kete-feedzirra"
ERROR: could not find gem kete-feedzirra locally or in a repository
"gem install --no-rdoc --no-ri libxml-ruby"
ERROR: could not find gem libxml-ruby locally or in a repository
"gem install --no-rdoc --no-ri http_url_validation_improved"
ERROR: could not find gem