Reputation: 1
im begginer in RoR. help me please. i use windows xp, ruby 1.9.2, sqlite 3.7.5 it r my steps for creating new.
in database.yml:
development: adapter: sqlite3 dbfile: db/test.db
and have trouble on page: ArgumentError No database file specified. Missing argument: database but i must seeinterface for work with table
in cmd after i see: ArgumentError (No database file specified. Missing argument: database):
in cmd after: rails generate scaffold Article Article
i spend this: Missing type for attribute 'Article'. Example: 'Article:string' where string is the type. help me please
Upvotes: 0
Views: 2665
Reputation: 263
The first answer is the correct one. If you are scraping your code and need a test start off doing something like this.
#!/usr/bin/env ruby
# Hyra Power
# 11/24/15
require 'active_record'
# ActiveRecord::Base.logger = Logger.new(STDERR)
# ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
)
ActiveRecord::Schema.define do
create_table :pages do |table|
table.column :url, :string, :null => false
table.column :title, :string
table.column :content_type, :string
table.column :last_modified, :datetime
table.column :error, :string
end
create_table :links do |table|
table.column :from_page_id, :integer, :null => false
table.column :to_page_id, :integer, :null => false
table.column :count, :integer
end
end
class Page < ActiveRecord::Base
has_many :links
end
class Link < ActiveRecord::Base
belongs_to :page
end
Test this script and then move on from there. Hope this helps anyone new.
Upvotes: 0
Reputation: 1
i used: rake db: migrate. and i see this:
rake aborted! No database file specified. Missing argument: database
Upvotes: -1
Reputation: 31467
It's now database
in YML, not dbfile
anymore. Try with the following yml in database.yml
:
development:
adapter: sqlite3
database: db/test.db
Here is a the guide to configure the database on rubyonrails.org.
Upvotes: 4