Displaying 20 results from an estimated 2000 matches similar to: "SQLite primary key schema"
2005 Dec 22
13
in-memory SQLite for testing
I am following the rails book, and arrived to the section about
testing. The test database is configured as:
test:
adapter: sqlite3
database: ":memory:"
and I get this error with the simple product test:
% ruby test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
E/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/
errors.rb:94:in
2006 Jan 02
3
Selecting conditionally from HABTM
Hello,
I was wondering whether there is a nice Rubyesque way of selecting
from a pair of HABTM models where one of them is inherited from
another object.
Here is the situation:
I have a ''posts'' table from which ''replies'' and ''articles'' are
inherited. Articles have_and_belong_to_many categories, but neither
posts nor replies do (it just does
2005 Dec 18
3
automatically generate migration from db/SQL?
Hi,
I''d like to use migrations to build my initial database. Is there a gem
or plugin that will generate the migration code for initial db if I
point it at a live database or sql file?
If yes, then can you automatically generate the incremental migrations
as well?
Thanks,
Jason
2005 Dec 23
2
SQLite in-memory
I left ":memory:" in database.yml for testing and the most simple
tests in the Agile book do not work (see trace below for test_truth).
Since that''s what comes with the distributed database.yml I suppose
it''s me doing something wrong.
Did someone get SQLite ":memory:" working? How does it grab the schema?
-- fxn
% rake test_units
(in
2005 Dec 19
3
created_on, created_at defaulting to 2000/01/01 00:00:00
Hello all,
Rails 1.0.0
created_on is being set to 2000/01/01 00:00:00
Any ideas on this ?
Thanks!
Schema is
create table user_login_history (
id int identity(1,1) not null,
user_id int not null,
created_on datetime default(getdate()) not null,
created_at datetime default(getdate()) not null,
updated_on datetime default(getdate()) not null,
constraint pk_user_login_history primary key clustered
2006 May 24
1
AR many-many join tables - can they have created_on, updated_on ?
Hello all,
I''m creating a many-many join table between ''homes'' and ''users''. Can it
contain created_on? will AR update created_on, updated_on on this table?
CREATE homes_users (
home_id int not null,
user_id int not null,
created_on datetime null,
updated_on datetime null
)
Thanks for your advice!
--
------------------------------
Apple MacBook.
2007 Aug 14
1
find_by_sql vs connection.select_all
I was trying to do SUM based mySQL query simliar to the following:
SELECT SUM(updated_on - created_on) AS total from signups
If I were to run this command in the mySQL console I would get a
result. However, if I were to run it using the following command in
Rails:
Signup.find_by_sql("SELECT SUM(updated_on - created_on) AS total from
signups")
The query that is written to the log is:
2008 Jun 16
2
call_backs Is it?
Hi
I have the models
1.ServiceDeskTicket with fields
id --- number --- service_desk_status_id -- created_on -- updated_on
etc
2.ServiceDeskActivity with fields
id -- service_desk_ticket_id -- description -- created_on --
updated_on
3.ServiceDeskAttachment
id -- service_desk_ticket_id -- attachment -- created_on --
updated_on
Relations as
ServiceDeskticket has_many
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
Hi you all,
I have a model simulating an ActiveRecord model, according to the tips
stated in [1]. It is simulated because even though I am gonna save the
attributes in a file, not in a DB, I still want the validations made by
ActiveRecord::Base (see code below).
Well, the thing is that I also want the behaviour of the created_on and
updated_on columns, that get modified automatically before
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
2005 Dec 27
3
created_on & updated_on - helper to display date only
All,
My initial list is rather busy. I would like to shorten the
created_on and updated_on fields to just display the date, not the
time. Best wold be a simple 12/28/05 type of presentation.
I''ve found the format helpers in rdoc. (ie.
distance_of_time_in_words_to_now ), but none seem to be what I''m
looking for.
How do I control the date format of a timestamp field?
Thanks
2006 Apr 26
5
accessing created_on causes type error
I assume that this is some newbie stupidity, but I haven''t found my
way around this problem. I have an ActiveRecord object fetched
from the database, and I need to evaluate the contents of the
updated_on field. However, *any* attempt to access that data in the
program results in a TypeError with the message ''no implicit conversion
from nil to integer''.
cust =
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all,
Im trying to get my head around rails and to help along Im working
through "four days on rails" as this seems to give a good real world
example with multiple tables and relationships (the main thing I cant
work out!)
Ive got stuck. Some help would be really good here.
The controller has this code:
def list
@category_pages, @categories = paginate(:category, :per_page =>
2019 Jul 16
9
Windows Source Client
I'm looking for a good source client that runs on windows 10 that can take
a feed and stream AAC MP3 and possibly Opus to my icecast2 server.
Everything seems dead on the app list.
I found rocketcaster but I'm hesitant to spend money on something I've
never heard of.
Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
Hi All, I''ve tried to do my searches, but can''t find reference to
this anywhere - My question is about ActiveRecord inserts and IDs. I
have a join table that both the models of the source tables join with
"has_and_belongs_to_many". It seems like ActiveRecord is setting the
"id" field for the join table- This should be an auto_increment and
2006 Jun 20
3
find ''newest'' of a model
I have a model which has the created_on and updated_on fields. I would
like to find the newest instances of my model from the database(for
instance, last 10), but as I''m only 6 weeks into my Rails development, I''m
not entirely sure how to do it. Any suggestions?
Thanks,
David
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to,
habtm, and the new has_many => :through relationships.
Whenever I try a
find(:all, :conditions => "some conds", :include [:relationship])
it works fine, but if I have
find(:all, :conditions => "some conds", :include [:relationship,
:other_relation])
it gets a sql error such as
Mysql::Error: You
2006 Feb 23
4
MySQL Duplicate Key Error
I am a newbie and I am running into a problem which I cant understand. I
have a table called ''privileges'' which has the following fields
CREATE TABLE `sdqualplanner`.`privileges` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(20) NOT NULL default '''',
`description` varchar(100) NOT NULL default '''',
`section_id`
2006 Feb 23
0
Problem with db_schema_import and MySQL timestamp!
Hi,
This post concerns a SQL error while I try to import a schema into MySQL
with timestamp dates.
To reproduce try these commands:
mickey@bunny:~/dev/rails/timeonrails$ rake db_schema_dump
(in /home/mickey/dev/rails/timeonrails)
mickey@bunny:~/dev/rails/timeonrails$ cat db/schema.rb
# This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord
2006 Jan 03
4
in-memory test database -- where''s the schema?
I''m trying to get the unit testing for a new project to use the wonderful
:memory: database specification for SQLite. However, like many people
before me, I can''t get the schema to import or have anything else useful.
Initially, the error I get is:
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb:94:in
`check'': cannot rollback - no transaction is