How do i create the rails 3.1 application using mysql - mysql

How to create a rails 3.1 application using mysql. The following command used to create the project with sqlite database.
rails new depot
I'd like to use mysql then sqlite. So can anyone tell me how to create a project with mysql.
Thanks

See help for rails new command
rails new --help
-d, [--database=DATABASE]
Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
# Default: sqlite3

You should use:
rails new depot -d mysql

Related

Migrate Ruby on Rails from Postgres to mysql - equivalent to activerecord-postgres_enum?

I am trying to install an existing Ruby on Rails project locally on my dev server where I run everything on mysql... the project however was built with Postgresql in mind. I am trying to change all parameters and to run "gem install" and yarn and then setup the db with "rails db:prepare" but I got stuck as there's a gem "activeRecord-postgres_enum" which obviously I commented out... but then the db creation fails:
undefined method `create_enum' for ....
How do I resolve this? Do I need to alter the actual ruby code or is there a gem that does the equivalent for ENUMs in mysql space that the above mentioned does for Postgresql?

Use MySQL workbench to create tables and data for rails app

Can I use MySQL Workbench to create the tables and add data then import / connect that into my Rails app? My Rails app is already connected to MySQL. I am just wondering if I create tables in MySQL Workbench through the app_development schema if that will sync over to my Rails project or not and if there's a way to check to see if it worked?
You can use
rake db:schema:dump
to generate schema.rb from an existing database.
Having schema.rb, you can generate an empty initial migration and put create_table and other statements from generated schema there. Doing this will allow you to use all the relevant rake tasks just as if you developed your database "the Rails way" — via a series of migrations.

How to use mongoDB database with Magento?

I am working on a project for Magento. I am recently using MYSQL database. I want to migrate it to MongoDB database.
I have installed MongoGento on my system to interlink MongoDB and Magento.
I have run the following command on my command prompt:
php < <(wget -O - https://raw.github.com/Smile-SA/mongogento/master/installer.php)
But was in vain as it was not working.
Please guide me how can I run Magento in MongoDB.

require 'mysql',No such file to load -- mysql in ROR development serevr but working when running as ruby application

Hi I am a newbie to Ruby on rails
when I try to access Mysql database manually in Ruby on rails development server,I get a No such file to load -- mysql at line require 'mysql',but when I try to run the same code as a ruby application,it does not throw any error and connects to DB.
I have searched a lot about this but couldn't solve the issue.
and Yes I have already installed mysql through gem and already put libmysql.ddl in my ruby/bin folder.
my ruby version is 1.9.3
Please Help ,Thanks in advance

Connecting already existing MySQL table to already existing Scaffold

So, I know that it is certainly possible to connect an already-existing MySQL database to a completely new Rails application through rake db:schema:dump and by configuring the database.yml file, as shown in a couple of Stack Overflow questions and through this blog: Ruby on Rails Tutorial: Creating a Rails Instance from an Existing MySQL DB.
However, is it possible to link an already existing scaffold in Rails 4.1 - one that is generated through say,
rails g scaffold person \
firstname:string lastname:string gender:string age:integer
(and this scaffold is generated with the default SQLite setting), and say you have a MySQL database on AWS named people with columns firstname:string lastname:string age:integer.
Is there some way to link up the rails app to this existing database in such a case?