Displaying 20 results from an estimated 30000 matches similar to: "migration from an existing database"
2009 Mar 25
11
ActiveRecord: Nested :include erroneous behavior
Hi,
Found a simple example breaking on moving to 2.2 from 2.0. This
example illustrates the usage of nested :include finder options.
class Book < ActiveRecord::Base
has_many :distributors
end
class Distributor < ActiveRecord::Base
belongs_to :book
has_many :agents
end
class Agent < ActiveRecord::Base
belongs_to :distributor
has_many :shops
end
class Shop <
2008 Jul 15
9
Beginner Question.
I''m just getting into RoR, coming from a long PHP background. So far I
LOVE IT!
I''m hitting a roadblock with updating my mysql database. For
simplicities sake, I have 2 tables and here are the relevant columns.
Table Users
id
name
email
Table Issues
id
createdby
assignedto
reportedby
In my models I have everything mapped properly I believe.
When I try to update the
2008 Sep 03
5
Eager load associations in Oracle problem with more than 1000 records
I think Rails 2.1 introduced a bug when eager loading of associations
with Oracle. In 2.1 ActiveRecord loads the included table with a big
''IN'' query: ''where association.id in (1, 2, 3, 4...)''. The problem
is that Oracle has a hard limit of 1000 values in an IN clause. I get
this error:
''OCIError: ORA-01795: maximum number of expressions in a list
2008 Oct 08
11
Using image_tag and send_data
I am using image_tag to load an image that I''ve saved to the database
(using attachment_fu if you''re curious but that''s probably not
relevant here):
VIEW
<%= image_tag ''/photo/get_image/5'' %>
CONTROLLER
def get_image
@photo=Photo.find(params[:id])
send_data(DbFile.find(@photo.db_file_id).data,
:type =>
2008 Aug 24
11
link_to_function check javascript attribute
How could I check the value of an javascript object''s attribute?
<div id="new_item_details" style="display:none"></div>
<%= link_to_function("Show details...", nil, :id => "show_details") do
|page|
page.visual_effect(:toggle_blind, :new_item_details)
if (page[:new_item_details].style.visibility ==
2008 Oct 08
9
Plugins and the test environment
Hi guys. I''m writing a plugin for use in the test environment.
However, when I run ``rake test'''' or ``rake spec'''', RAILS_ENV is set
to "development" when my plugin''s init.rb is run.
How do you configure a plugin to load require a file in the test
environment?
Thanks,
Nick
--~--~---------~--~----~------------~-------~--~----~
You
2009 Mar 05
7
issue with the object cache
Hi,
I am getting a method_missing error when I run my application in the
production environment unless I set config.cache_classes = false in
config/environments/production.rb. This happens in Rails 2.2.2 but not
in Rails 2.1.0. The method that is missing is one I used to have
before I edited by hand the migration that creates the table
associated with the object (I know you are discouraged to do
2010 Oct 06
6
Error on running unity test: "no such file to load -- 'active_record/version'"
Hi folks!
I''ve been experimenting an error messagem when I try to run unity test
in any model of my project.
Here it is:
/home/fabricio/shopcell/config/environment.rb:1:in `require'': no such
file to load -- active_record/version (LoadError)
from /home/fabricio/shopcell/config/environment.rb:1
from ./test/test_helper.rb:2:in `require''
from ./test/test_helper.rb:2
2008 Oct 08
5
schema.dump chokes on RAW type
I haven''t seen anyone mention this yet.
The tail end of the migration process is a call to schema.dump. Our
primary keys are uuids and these choke schema.dump on both oracle and
postgres. The latter fails silently (skips three tables) while the
former complains about the RAW(16) in each of the three tables.
Anyone had a similar experience?
--
Posted via http://www.ruby-forum.com/.
2009 Aug 16
3
Rails without a database
Hello! I can''t find a way to have rails not use a database. I just
left my database.yml file as it is. When I run my rails application
that has no models, my browser says that it couldn''t connect to a
database. In environment.rb I uncommented the line
config.frameworks -=
[ :active_record, :active_resource, :action_mailer ]
but then Webrick won''t start. Sorry if this has
2008 Jul 01
14
rake aborted! Could not find table ...
I am getting a rake aborted error and I suspect that I am missing a
package on my system since the app works for a friend on this
computer.
Here is the terminal output of the error:
anita@anitas-computer:~/sandbox/shovell$ rake db:migrate
(in /home/anita/sandbox/shovell)
rake aborted!
Could not find table ''stories''
(See full trace by running task with --trace)
2009 Jan 05
5
ROXML versus simple to_xml
How they differ?
Does the to_xml method of the classes array/hash/object is based on
ROXML lib?
As I see in http://roxml.rubyforge.org/#quickstart, roxml needs we
define the class (class Book in the guide) before to convert a object
to xml. Moreover, the method to_xml (when not using "include ROXML")
just accepts any existing object, what is much suitable.
I need to compare and tranfer
2008 Apr 16
8
Will acts_as_taggable_on_steroids and better_nested_set work together?
I am having this crazy problem where it ONLY shows up in testing.
This is my test code
<code>
def test_should_destroy
task1 = Task.new(:description => "tmp",
:done => false,
:user => User.find_by_login(''admin''))
assert task1.save
assert task1.destroy
end
</code>
This is my task model
2009 Nov 03
12
Mysql::Error: query: not connected
Hi there!
I am PHP developer and trying to learn ROR. Currently I am building my
first Rails website (OS X Snow Leopard, TextMate) and decided to
switch from sqlite to mysql. After many-many hours of searching the
internet I managed to install mysql gem. Now I get this error when I
try to run rake migrations:
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations`
2011 Apr 25
3
Active Record database time logging
I''ve been having a look through the code responsible for printing how
much time was spent in Active Record at the end of an action. My
reading of the code + experiments suggests that any database time
after the render is not counted.
It seems to me that in controller_runtime.rb in Active Record,
append_info_to_payload should in fact read
def append_info_to_payload(payload)
super
2008 Sep 02
7
Deploying My Rails App
I have just finished my first Rails application following the
lynda.com tutorial, but I am not sure how to get my application on the
internet.
I have an ftp account through the applemachine server, but from what I
have read, I''m afraid I will not be able to host my application there.
What I am looking for is step by step directions on how to get from a
working Ruby on Rails application
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2008 Nov 28
3
Beginner: "NameError - uninitialized constant" when I create a model object
My first Rails example using model and I got this NameError:
NameError in VandaController#att
uninitialized constant VandaController::Compute
Same code works fine if I don''t create the Compute object.
What did I do wrong?
Here is the Controller
class VandaController < ApplicationController
def att
@compute = Compute.new
@data1 = @compute.cmpt
end
end
Here is the Model
2011 Aug 05
6
"bundle install" fails because of git gem
Hey everyone,
I''m having an incredibly difficult time getting bundle to work
properly on my production server.
My production server setup:
Ubuntu 10.04
Ruby 1.9.2p290
Rails 3.0.4
Passenger
rvm 1.6.32
My Gemfile (relevant parts):
gem ''linkedin'', :git => "https://github.com/renatosnrg/linkedin.git"
Whenever I try to do "bundle install" I get this
2008 Jun 05
23
unit test question
In development and production, I''ve got postgresql constraints that
prevent deleting a CaseManager if there is a Client that belongs to that
CaseManager.
In unit tests...and obviously in my testing db, those restrictions don''t
get added.
Is it wrong to test for deleting dependent records in unit tests?
Craig
--~--~---------~--~----~------------~-------~--~----~
You received