How to disable sqlite3 while using neoid? - ruby-on-rails

I am using neoid with rails and want to disable sqlite in my rails application. How can I do this (after that I want to use only neoid and neo4j to store the data)?

Remove
gem 'sqlite3'
from your Gemfile and make sure that your config/database.yml file doesn't contain lines like
adapter: sqlite

From my testing with it today I don't think you can do this with this gem. Neoid adds neo4j storage as an addition to, not replacement for, your traditional RDBMS.
To have a full replacement for RDBMS-backed ActiveRecord you may need to consider the neo4j.rb gem, which requires JRuby.

Related

specify database adapter on Heroku

I'm using pgcrypto gem to encrypt data in certain columns of the database, but in order for this gem to work I have to specify pgcrypto as an adapter in database.yml file. I know that Heroku disregards this file and generates its own when application is pushed to Heroku server, which uses default postgresql adapter. Does anybody know if it's possible to override adapter value, with a configuration variable for example?
Eventually found the solution, which happened to be a quite simple one - I just had to replace the first token in the Heroku's database URL variable, so instead of
postgres://username:password#host:port/dbname
I use
pgcrypto://username:password#host:port/dbname
You can manually create a database connection with
`ActiveRecord::Base.establish_connection(config)
you could also do this on a per-model basis using a mixing.
More info is here Understanding how establish_connection works in ActiveRecord

Rails: Removing migrations/schema created by gem on uninstall

Is there an easy way to drop tables created by a gem when I am installing it? For my specific case I want to uninstall the gem and reinstall it but the old tables and data are still there. Right now I plan on dropping the created tables manually. Is there a way to see all the tables created by a gem?
There is no easy way to see all the tables created by a gem, unless they're namespaced within something sensible. For example, Forem namespaces all the tables with a forem_ prefix.
You would need to create a migration and drop the tables manually.

rails sqlserver views

how is it possible to work from rails and use sqlserver views?
rake db:schema:dump
doesn't generate schema for views
I've used rails_sql_views gem but something is buggy. probably because of sqlserver
Yes, it possible, and sometimes convenient. I'm using views to fetch some data from legacy database. But views are read-only.

Rails - disable db connections

There's a Rails 3.2.3 web application which doesn't use any database. But in spite of that if I use the gem 'sqllite3' in GemFile I works perfect. But if I use gem 'pg' in that file it throws an error
ActiveRecord::ConnectionNotEstablished
Of course, I use different versions of database.yml when I use postgreSql or SqlLite3.
But I definitely don't use any database.
Why is it happening? What should I do to solve it? And how to disable using databases?
See the SO question here for how to bypass using a database. It's a little more work than just setting a flag.

Testing a Rails app without a database

I have a Rails app (Rails - 2.3.8, Linux) which uses a MySQL database, but the database is generated separately (not through the Rails migration), so I would like to know
How can I implement testing on this application (please note currently there are no test suit at all)?
I would prefer not to have a database at all and test the functionality (including ActiveRecord models through the unit test) (because it will make the test suit independent as I see).
Currently I found this gem (temping - https://github.com/jpignata/temping) via a Stack Overflow link itself.
Please let me know if I'm going in a wrong direction.
This is a great resource on one method of TDD using RSpec which is more powerful than unit testing imo.
http://railscasts.com/episodes/275-how-i-test
If you are avoiding using MySQL you could simply specify Sqlite3 in your Database.yaml file:
test:
adapter: sqlite3
encoding: unicode
database: gc_test
pool: 5
Be sure to include Gem:
gem 'sqlite3-ruby'
If you have having trouble with this install, checkout this question:
Why can't I install the SQLite gem?

Resources