Displaying 20 results from an estimated 7000 matches similar to: "AWDwR2: Loading data in migrations"
2006 Apr 04
2
loading data with migrations
Hello,
I''m just taking a look at migrations, seems like a fantastic way to maintain
the database. I am wonder if there is a way to maintain what I''ll call
"reference data" along with the migrations. A lot of times in apps your
have tables that have pretty static data, often used to generate select
lists. Is there a way to insert the reference data into these tables
2006 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml:
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
admin:
id: 1
username: admin
password: admin
pbarry:
id: 2
username: pbarry
I have a unit test for my user model:
require File.dirname(__FILE__) + ''/../test_helper''
class UserTest < Test::Unit::TestCase
fixtures :users
def
2006 May 31
7
How do you create a controller & view to create a list of objects?
I''m trying to figure out how to design a view and controller to work with a
simple collection. I have a Foo that has many Bars, so here''s what I did:
$ ruby script/generate model Foo
$ ruby script/generate model Bar
(Uncomment t.column, :name: :string in foo and bar migrations)
(Edit Foo.rb and Bar.rb, add has_many :bars to Foo, belongs_to :foo to Bar)
$ rake db:migrate
$ ruby
2005 Dec 14
3
Plugin w/ Migrations and/or Fixtures?
I''m working on a plugin which needs to add both schema and data to the app
database, and I''m trying to figure out the best way to do it. I''d like to use a
db migration to modify the schema and load the data from a YAML fixture, but
Rails doesn''t seem to support migrations for plugins. To do so, the schema_info
table would need to change to include a
2006 Mar 09
4
Testing Migrations
Is there some standard way to test migrations?
It seems to me that an additional safeguard for migrations would be to
test and see if applying the migrations to the test database allows one
to reconstruct the structure of the development database.
If you can''t, then there is an error in your migrations, most likely
because someone hand-modified the database without generating a
2006 Jan 14
6
Error installing Rails/FastCGI/Apache2
Trying to install rails/fcgi/apache2. Following these instructions:
http://xmlareas.com/ruby-rails-howto.html
Using Fedora Core 4. I installed ruby and ruby-devel using apt-get.
Everything under Adding FastCGI (optional) works fine up to the gem install
fcgi part. Here is what happens:
[root@paulbarry fcgi-2.4.0]# gem install fcgi -r --
-with-fcgi-lib=/usr/local/fcgi/lib
2006 May 25
24
Make these a prt of Ruby on Rails!
3 things that should be part of the main Rails tree:
http://www.redhillconsulting.com.au/rails_plugins.html
Views?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 04
4
How to read rails documentation
One of the criticism I have heard about rails is that the documentation is
bad. I must admit I have a hard time trying to follow it and I wonder if
anyone can shed some light on it for me. For example, I am looking at the
schema.rb file generated and I noticed this line:
create_table "accounts", :force => true do |t|
I thought to myself, what does :force => true mean? So I
2006 Jun 29
14
TDD and migrations?
TDD, SVN and migrations seem to be a natural combination for model
development: create a test, add the column with a migration, write the
code, and check it all in when you''re done.
The trouble is that this ends up creating one migration per field. I guess
it''s not horrible in and of itself, but it does have a code smell to it.
Has anyone come up with a different way of doing
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i
have their d.o.b. stored as a date in my db.
cheers
--
Posted via http://www.ruby-forum.com/.
2006 Jan 25
1
Migrations for populating authority tables
I''ve got a number of fixtures which populate ''authority'' tables in an
app (eg tables which are used to construct the values of selects or
valid ''constants''). These will be updated infrequently and are
''configuration'' data, so I''m not sure its worth constructing an
interface to do this in the deployed app.
Seeing as
2006 May 29
7
re-coding a sizable PHP app in rails
Hello,
I am the developer of a fairly major PHP app. It has the full
compliment of web application goodies -- email, batch processes, cc
transactions, multi-level authentication, security, content management,
curl-type interaction with other applications, etc. I am obsessed with
the idea of re-doing a year and a half of work in Rails and the more I
learn the worse my itch gets. I feel
2007 Feb 03
1
Postgres + tsearch2, migrations, and unit testing
I''m sure people have encountered this before, but I''ve been
unsuccessful at finding anything about it.
Basically, I got a rails app that uses postgres and tsearch2 for some
full text indexing and I''d like to be performing unit tests. Now,
there''s the whole deal of how to get the test database to load all the
tsearch2 information properly.
I tried to come up
2007 Jun 02
2
Unit tests breaks with sqlite
Hi,
I''m using an sqlite3 database with Rails and have some trouble running
unit tests
What I''ve done is
* rails my_app
* edited database.yml to use sqlite3 adapter, db/my_app_development
and db/my_app_test
* ruby script\generate model user
* edited model
class User < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
end
*
2006 Jul 31
1
Migrations that set default values
To reverse a migration that sets a default value, do you set the default to nil?
And, if you''re setting a couple of default values just to make early
development easier, is it best to do that directly to the database and
not clutter your migrations with them? (I.e., it''s not a *real* db
change.)
Thanks,
--
Austin Govella
Thinking & Making: IA, UX, and IxD
2006 Jan 17
2
Does anyone use RedCloth to allow end user input?
I was hoping to use RedCloth for textilize support to allow end users to
enter textilized text (In blog comments, for example), but these bugs seem
to make RedCloth unsuitable for that purpose:
http://rubyforge.org/tracker/index.php?func=detail&aid=2989&group_id=216&atid=891
http://rubyforge.org/tracker/index.php?func=detail&aid=1779&group_id=216&atid=891
2006 May 07
2
label tag with errors?
I''d like to create a label tag that has a special css class if has errors.
So Ideally, I''d like:
<%= label(''object'',''property'',''Property'') %>
To generate:
<label for="object_property">Property</label>
And if there are errors on object.property, generate this:
<label
2008 Jun 05
3
what is proper way to load lookup/reference data into test database?
I''m just getting into writing tests for my first RoR app. I''ve got a
few data migrations to load reference data (i.e. 2-char state abbrevs,
payment types, etc.). How do I get that data into the test database?
I understand fixtures are to load test data. But if I duplicate these
lookup tables in test fixtures, it seems like that is violating the
DRY principle. Is that OK in
2006 May 02
96
[ADV] Second Edition of Agile Web Development with Rails
ANNOUNCING AGILE WEB DEVELOPMENT WITH RAILS, SECOND EDITION
===========================================================
http://www.pragmaticprogrammer.com/titles/rails2/
Rails has changed a lot since we announced the first edition of the
book a year ago. DHH says that the 1.1 release "boasts more than 500
fixes, tweaks, and features from more than 100 contributors." Who
are we to
2006 Jun 24
2
Migrations problem with Agile Rails book
I am following the instructions on Agile Web Development with Rails book "Iteratio E1: Capturing
an Order" section. When I run the migrations I get the following error.
rake db:migrate
(in /Users/balaparanj/work/depot)
-- execute("alter table line_items \n
add constraint fk_line_item_products \n
foreign key (product_id) references products(id)")
rake