RoR MySql Linux Set-Up - ruby-on-rails

I'm trying to get RoR installed on my Ubuntu install and have it running with MySql. RoR and MySql have both installed fine and working but I'm having problems getting rails to work with MySql following this tutorial: http://wiki.rubyonrails.org/getting-started/installation/linux
To test your Rails installation, generate a new Rails project:
$ rails myrailsapp
If you are using MySQL, use the following command:
$ rails myrailsapp -d mysql
Now I know that you now have to type rails new [appname] not just rails [appname] to get this working once this is done and project is created its still using the sqlite3 databse so I run the next line $ rails myrailsapp -d mysql when I do this I just get a large list of text giving me various options with out changing anything.
What have I done wrong?

You actually want to generate the project with the -d specifier, not apply it to your project after generation. Start a new project like this:
rails new myrailsapp -d mysql

You need to enter just one command:
rails new railsappname -d mysql
It will create a rails app with mysql configuration.

Welcome aboard #twigg to the Rails world =).
First of all, you have to specify your Rails version you installed. If your Rails version < 3 then you can create a new project by simply running the command rails my_app_name. If you are using Rails > 3 then to create a new project just run the following command rails new my_app_name. This command will create a bunch of files one of them is the database.yml where you can configure you database parameters (adapter, username, password and database name).
If you are using Rails with MySQL, then to create a project configured with MySQL, just run the command rails my_app_name -d mysql in Rails < 3 or rails new my_app_name -d mysql
Don't forget to install the adapter of the database which is in your case (MySQL) ruby-mysql by running the command gem install ruby-mysql

Related

rails aborted when create a new folder

I am meeting a rails problem.
I created a rails folder by this command
rails new airbnb-clone -T -d postgresql --css tailwindcss
And it gave me these problems
1st
rails turbo:install stimulus:install
rails aborted!
Second
rails css:install:tailwindcss
rails aborted!
I thought that when I used the code tailwindcss, it must automatically create the tailwindcss by rails ? So why it had these error ? Should I must install tailwindcss by hand ? Could you please give me some advices?
By the way, here is my rails and ruby v
rails -v 7.0.4
ruby -v 3.1.2
Just change the argument to tailwind instead of tailwindcss:
rails new airbnb-clone -T -d postgresql --css tailwind
I use this command, you can try. I think that's oki.
rails new airbnb-clone -T -d postgresql -c=tailwind

How to install mysql in rails in newer ruby version?

I would like to how we can install mysql in rails in newer version ruby installed?
I tried this command below:
gem install mysql2
But I've got an error below:
I'm using windows 10 home, already installed ruby installer and run some rails app(using sqlite db).
if you creating new rails application with mysql
rails new app_name -d mysql

Ruby on rails command does not trigger any action

I'm not to ruby on rails, and I'm setting up my first application, according to a textbook (Ruby 4 in Rails). No action is triggered, When typing the command:
$ rails generate scaffold purchase name:string cost:decimal
Can anyone help me resolved this?
I installed Ruby and Rails, newest versions and then did the following steps before typing the mentioned command.
$ rails new things_i_bought
$ cd things_i_bought
$ rails server
When you do
$ rails server
You're starting the server. You don't to want do that when working from the command line.
Hit Ctrl-C to stop the server, then run your scaffold command.

How to start another rails project along with the current project on Ubuntu 12.04?

I was trying to run another Rails project along with Diaspora.
I used the commands rails server -p 3001 and rails server -p 3002 in the same directory with cd Diaspora.
I visited http 127.0.0.1:3001 and in project two http 127.0.0.1:3002.
But I could open diaspora server only on both the ports.
I also tried to create a new project folder (Projects) in the directory Diaspora.
cd Diaspora
cd Projects
rails new project2
I got this output:
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
How do I solve this problem?
It looks like you started Diaspora two times.
First make sure to you have Diaspora and your other projects alongside each other, not nested.
~/Diaspora
~/Projects
Then change into your projects folder, get the latest version of Rails and create a new project:
cd ~/Projects
gem install rails
rails new project2
cd project2
bundle install
There start your other project first:
cd ~/Projects/project2
bundle exec rails server -p 3002
Now in a second shell start Diaspora:
cd ~/Diaspora
bundle exec rails server -p 3001
Make sure to use bundle exec to avoid any version conflicts between the gems Diaspora uses and the gems your new application uses.

ruby on rails on snow leopard

I tried the rails site_name command to create a rails application. The command says that the usage is rails new APP_PATH[options]
I tried the rails new site_name command.
I dont get any server file inside my site_name/script folder to run the application.
why is this happening?
Use
$ rails server
to start the server. In general with Rails 3, any command you would have previously run with ./script/... you now run with rails ...

Resources