Displaying 20 results from an estimated 1000 matches similar to: "postgres migration notices"
2008 Nov 14
3
migration with data
Hi
I am using postgres and have two migration files like
001_create_categories.rb as
class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.column :name, :string, :limit=>80
end
end
def self.down
drop_table :categories
end
end
and 002_populate_categories.rb
class PopulateCategories < ActiveRecord::Migration
2006 Jul 25
2
Losing precision while copying interval type data (Postgres)
Hi
I am trying to use active record to copy some data. One of the entry I
am copying is type interval (Postgres); however, it lose some precision
after I copied that column.
Here is what I did:
@newData.elapsedtime = @oldData.elapsedtime
@newData.save
Result:
both displayed as 00:00:02.453 in the table, however, if I use the
following command to convert its value into float
( SELECT
2008 May 19
2
x is not a number error??
I may be overlooking something really obvious here but I''m not getting
it. I have a Category model. Categories can have sub categories and
parent categories, but when a category doesn''t have a parent category,
its "parent_categoryid" field is set to null. As far as I know, what I
am doing here has been working in the past because there are many
categories in my
2006 Nov 24
7
Anyone know whats going on with PostgreSQL async_exec errors?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Anyone know what''s going on with ActiveRecord Edge and 1.2RC1 unit
tests. I get 13 failures from the "async_exec" method call. ie:
test_callback_rollback_in_save(ConcurrentTransactionTest):
ActiveRecord::StatementInvalid: NoMethodError: undefined method
`async_exec'' for #<PGconn:0xb75a8754>: SET
2006 May 01
10
large file storing in postgres sucks?
Hi,
I''m not sure if this is a postgres issue or not, but I''m using
Postgres 8.1. I have (in my functional tests) the following code:
upload = fixture_file_upload(''/files/podcast.mp3'', ''audio/mpeg'')
post :create, :product => valid_product, :media => { :image => upload }
And then in the controller:
blob = Blob.create :data
2006 Jul 21
3
[Slightly OT] CSS with wildcard?
Sorry if this is a simple question, I''m a CSS noob.
I have a rails app that is displaying posts, I am having it generate
each post with its own div like "post_19", "post_20", etc.
I could make it so it puts another div around that div (i need the
individual post div''s for deletion with AJAX) but would rather not.
Is there some way to use CSS to do
2006 Mar 23
4
Postgresql connection problems
Forgive me for asking a trivial question on this list, but being new
to Ruby/Ruby on Rails, I''m not sure where to start....
I''m trying to connect to a postgresql server:
My database.yml contains:
test_test:
adapter: postgresql
database: test_test
username: testuser
password: resutest
host: testpgserver
port: 5432
encoding: UTF8
min_messages: warning
The
2010 Mar 29
4
error in uploading file(help me urgnt)
when i tried to crate an upload file application in rails i am getting
error like this
Template is missing
Missing template app\views\upload\uploadfile.html.erb in view path
app/views
this is ma model
class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload[''datafile''].original_filename
directory = "public/data"
# create the
2006 Aug 05
10
Converting mysql to postgres
Hi,
Anyone got any cool tricks for converting a Rails site (in this case,
a typo installation) from a mysql database to a postgresql database?
I''ve got it almost working -- I''m doing a SQL dump from mysql and
loading it into postgres. However, mysql does booleans as a tinyint
with 0 = false and 1 = true. When I try to import that into a
postgres database that expects booleans
2005 Mar 09
10
mysql vs postgres
I''ve used mysql for quite some time now. Other than crashing when the
partition gets full, I''ve had no problems with it.
But I''ve heard great things about postgres and have seen some people
say it''s much superior to mysql.
So, with a Rails application, is there any reason why I would want to
learn/use another DB besides mysql? Any pragmatic benefits?
2006 Jul 26
15
Rails without a primary key
I''ve been trying to use Rails on a database where the biggest
datawarehouse-style table doesn''t have a primary key. It really
doesn''t make sense and just adds extra unnecessary space. I do have,
however, a column that I normally use to search on (IP) that returns
many rows. The table also references several other tables through
rails-friendly foreign keys.
Simple AR
2006 Jun 21
3
Simple range question
I have a model with a datetime field called start_date. I''d like to do
a find on the model so that it returns only records with the start_date
equal to the current day.
Something like this:
@foos = Foo.find(:all,
:conditions => //?? start_date equal to today''s date
??// ] )
Thanks in advance for any help.
-------------- next part
2006 May 21
3
find with belongs_to -> belongs_to -> belongs_to
I have 3 tables
keywords (keywords attached to a file)
files (info about the file)
paths (path for the file)
[This is a legacy database, so I can''t change this]
keyword belongs_to file and file belongs_to path. Users need to be able
to search the keywords, but they only have access to certain volumes, so
the results need to be limited by the path. I also need to show paging,
2006 Jul 03
13
Remote Postgres is driving me crazy!
Hi guys,
I need your help. Here is my database.yml:
development:
adapter: postgresql
database: db
username: username
password: mypassword
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn''t need configuration. Windows does not
have
# domain sockets, so uncomment these lines.
host: 192.168.22.1 (this is a remote ip in
2007 Oct 09
5
Backticks wrapping SQL values in polymorphic associations...
Hopefully the subject line didn''t scare you. That said...
I have a simple polymorphic relationship (is that possible?):
class Part
has_many :attachments, :as => :attachable
end
class Attachment
belongs_to :attachable, :polymorphic => true
end
Calling Part.find(:first).attachments yields this SQL error:
ActiveRecord::StatementInvalid:
Mysql::Error: Unknown column
2010 Aug 20
0
Problem with db:create
My ruby app always created the databases on postgres just fine, but, a
days ago, I''ve tried to create a new project and when I execute the
command "db:create:all" i got the following error:
Couldn''t create database for {"encoding"=>"unicode", "username"=> "-my
username-", "adapter"=>"postgresql",
2011 Aug 12
16
Rack content-length Rack::Lint::LintErrors errors with unicorn
Has anyone seen anything like this before? I can get it to happen all
the time if I issue a HEAD request, but it only happens very
intermittently on GET requests.
I''m using Ruby 1.9.2p180.
Any ideas on where to start debugging?
204.93.223.151, 10.195.114.81 - - [11/Aug/2011 21:03:50] "GET /
HTTP/1.0" 200 37902 0.5316
app error: Content-Length header was 37902, but should be
2006 Jan 24
5
simple formmail question
I have a few forms that I''d like users to fill out. The results of
the form will be sent to a few addresses.
What''s the least painless way to do this and keep everything DRY?
There''s no database involved. Ideally, I''d like to email the form
questions with the answers inline.
Seems like using ActionMailer and separate email views would be
overkill in this
2006 Jun 29
6
adding a before_filter to static content
Hi,
I have a Rails site that uses a before_filter in the application
controller that does some authentication and authorization work.
I also have a bunch of HTML in folders in the application''s public directory.
Before a user can view anything in the public directory, I''d like to
authenticate them. How could I do that?
I''m using mongrel, if it matters.
Thanks,
Joe
2007 Jul 09
5
Color coding table rows depending on an attribute
I need to show a different background color depending on the type of
comment posted. The type of comment is determined from a drop-down
selection. I figured the simplest way would be to do something like I
have below, but I can''t seem to get it to work:
<tr <%= puts ''"style = "background: red;"'' if comment.comment_type ==
''Hiring