Displaying 20 results from an estimated 7000 matches similar to: "(Probably Easy) ActiveRecord help needed!"
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
Hi all,
Windows XP
Oracle 10g client
OCI8 0.1.16
Ruby 1.8.5
Rails 1.1.6
I''m hitting weird behavior with the Oracle adapter and a find_by_sql
call on a multi-table join.
The SQL looks like this:
SELECT DISTINCT e1.ip_address, loc.street, loc.city, loc.state
FROM schema.net_element ne, schema.equipment e1, schema.equipment e2,
schema.building b, schema.cust_loc cl, schema.location
2006 Aug 04
0
How to make prefix_sessions recognizable?
Hello,
i must use prefix to each of my tables for my project right now. Now i''m
facing this session stored in table problem.
i don''t use rake db:sessions:create, but i use script/generate migration
create_myproject_sessions
then
create_table :myproject_sessions do |t|
t.column :myproject_session_id, :string
t.column :data, :text
t.column updated_at, :datetime
end
then
2006 Nov 04
0
ActiveRecord, insert and not auto-incremented primary keys...
Hi,
After playing while with ActiveRecord, I''m surprised it isn''t easier to insert data into a table whose primary key is not auto-incremented by the database server.
The following code...
---------------------------------------
-- MySQL database "test"
---------------------------------------
CREATE TABLE gardens
(
code integer NOT NULL,
name
2007 Mar 01
1
ActiveRecord::StatementInvalid error
When I try to run my webserver in the production environment I just
get an application error message. This is all I can find in the log:
ActiveRecord::StatementInvalid
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
connection_adapters/sqlite_adapter.rb:274:in `table_structure''
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
2006 Jan 30
1
how to get column_for_attribute?
Hi all,
In the code below I don''t understand:
1. Why I have to prepend overriden method content_columns with "self."
to get it working?
2. Why column_for_attribute method is not working (no such method?) even
if SomeTable is subclass of ActiveRecord::Base which have public
column_for_attribute method?
> class SomeTable < ActiveRecord::Base
>
> def
2006 Jul 24
1
date_select and ActiveRecord find()
If I pass a date through date_select to a controller, can a Active
Record object be found based on this date that is passed? Here is
what my log says:
ArgumentError (Unknown key(s): publication_date(2i),
publication_date(3i), publication_date(1i)):
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/hash/keys.rb:48:in
`assert_valid_keys''
2006 Jul 20
1
file_column - assigning with an actual file rather than a multipart
Hi there,
I''m using the wonderful file_column and have struck an issue that
someone might have seen before.
My images already sit on the server. So, instead of passing a
multipart message I''m sending a file object.
Something like...
f = File.new("public/gallery_images/builder.png")
p = Product.find_first
p.image = f
p.save
On the save I recieve an error which
2006 Jul 28
2
Problems connecting to remote mysql db
Hi,
I am having a problem connecting to a remote mysql db and I can''t
figure out what the problem is. When I try to connect I get the error:
getaddrinfo: no address associated with hostname.
I have looked all over for clues as to what that means but I haven''t
been able to find anything that helps. I have no problems connecting
to the database with php and with the mysql query
2005 Apr 26
2
SQLite error
I have an app that seems to run fine when I develop on windows, but in
my linux deployment environment I get this error:
uninitialized constant SQLite
Here is the stack trace:
/usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:183:in
`const_missing''
2006 Jul 31
0
Issues with has_many, belongs_to and dependency settings
I have 2 models SmsAddress & OutboundSmsAtom
SmsAddress {
has_many :other_objects, :dependency => :nullify
}
OutboundSmsAtom {
#note this object also "belongs_to" other objects if that matters
belongs_to :this_object
}
Whenever I try to destroy an object of type ThisObject, which at the time
has 0 "children" OtherObjects I get the following type of
2006 Jul 24
2
Thread.new with ActiveRecord under Mongrel vs. FastCGI
Hi All,
I''m going to end up hosting a site on a server in a fastcgi environment,
but I''ve been doing most of my development under mongrel. I have a bit
of code that spawns a thread, and in the thread it makes some remote
calls (openuri) and does some database inserts via activerecord.
When I do this under FastCGI, everything appears to work as expected.
When I do it under
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
2006 Jul 31
2
ambiguous column name in has_many :through
In my application model I have three classes: Accounts, Projects, and Items
class Accounts < ActiveRecord::Base
has_many :items, :through => :projects, :source => :items
has_many :late_items, :class_name => ''Item'', :through => :projects,
:conditions => [''due_on < ?'', Time.now], :source => :items
end
class Projects <
2006 Aug 04
8
Demo in rails2.pdf of add_price migration, PostgreSQL 8.1.4
People,
I''m looking at the migrate example on p 74 of the rails2.pdf
It''s a simple example of using a migration to add a column to
the products table.
Here is a copy of the migration file named 002_add_price.rb
after I generated and then edited it:
class AddPrice < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal, :precision => 8, :scale
2006 Jul 09
2
Error using sqlite3
Hello, I''m trying to use sqlite3 and I''ve followed the steps here :
http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite
However I get the error above (uninitialized constant API) when trying
to run a migration.
I''m under Windows XP, using cygwin, the sqlite3.dll file is on the lib
directory of my rails app (filemon, an utility that reports file access
attempts
2006 Aug 04
0
Rake migrate errors, but it still works
I get the errors below when running rake migrate, but it still works.
Is there anything to be bothered about? Some appear twice.
All of the below are installed from portage in Gentoo.
me@machine ~/Site $ rake migrate
(in /home/me/Site)
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/validations.rb:334:
warning: `*'' interpreted as argument prefix
2006 Aug 09
0
Bug in ActiveRecord 1.14.4 and select_limited_ids_list method using mysql?!?!
All -
I just upgraded to rails 1.1.5 (per the announcement) which also updated
active record to 1.14.4 (was 1.14.2). I know have a problem...
Author has many Articles...
@authors = Author.find(:all, :limit => 10,
:offset => 0
:include => [:articles],
:conditions => ["hide =
2006 Aug 09
0
Bug in ActiveRecord 1.14.4 and select_limited_ids_list() ???
All -
I just upgraded to rails 1.1.5 (per the announcement) which also updated
active record to 1.14.4 (was 1.14.2). I know have a
problem...
Author has many Articles...
@authors = Author.find(:all, :limit => 10,
:offset => 0
:include => [:articles],
:conditions => ["hide = ?",
2006 Aug 01
8
Problem importing lots of records
I run a script that imports a few thousand records into the database.
The script runs once for each of several XML files. What it does is
parse the XML and for each element of a certain type creates a record in
a rails database that gets indexed with acts_as_ferret. This worked fine
before but today after a few files (70000 records) this started to
happen for any file I tried:
2006 Mar 31
1
Ruby 1.8.4 upgrade screws up ActiveRecord
Okay, so I upgraded to Rails 1.1 on my Windows development machine and
everything worked fine. Then I went to upgrade to Ruby 1.8.4 from
1.8.2, launched WEBrick and browsed to 127.0.0.1:3000 and here''s what I
get:
Errno::EBADF in Front#index
Bad file descriptor - connect(2)
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/vendor/mysql.rb:108:in