How to create your first ROR app with mysql database support on windows?

When you are creating your first app on ruby on rails it default supports “sqlite” database. You can see it while open the “Gemfile” of  your project using a text editer like “Sublime Text”. When your app’s data are growing  bigger n bigger the “sqlite” is not suitable to store that data. So there are some alternative database systems for that like “mysql”,”postgresql” or “oracle”. My preferred choice is mysql. So .in this post I’ll show you how to create you first ROR app that includes mysql database support.

First you have to install gemfile for mysql . This can be install issuing the following command in the terminal window.

 gem install mysql2

After that you can see the following progress on the terminal window

installing_mysql2_rubygem_on-windows

Then issue the following command to create new rails app that includes mysql support

 rails new testr -d mysql

After few minutes that will create your new rails app.

Now move to the development directory issuing the following command on terminal window.

 E:\>cd testr

Then issue the following command in  the terminal to run the app

 E:\testr> rails server

rails-_boot_up

Then open your web browser and  type the following url in the address bar

 http://localhost:3000

database_error

Oops.. ! . There is an error occurred 😦 . What can we do to resolve that error ?.

Ok, lets examine the database.yml in your app directory (in my example testr) using “Sublime Text” editor.

database_yml_sublime

It shows us that there is a predefined database “testr_development” and we haven’t a database in our mysql server.

So to get rid of this we open the mysql command line interface and must issue the following command in it

 mysql> create schema testr_development;

testr_database_schema

After that refresh the browser window and also see the terminal window. You can see that following  result shows mysql is correctly configured with you project.

terminal_suucess_rails.png

suucess_ror_mysql

Yay! Now you know how to make ROR app with the support of mysql database.

Thats all .

Have happy coding and have a nice day 🙂 !

How to create your first ROR app with mysql database support on windows?

Finally upgraded to ROR 5 !

I’ve experimenting web developing on Ruby on Rails as a hobby. Last few days I’ve work with ruby 1.9.3 and ROR 3.2.x and felt that I must move to ruby version 2.x.x and  ROR 5 because ROR community fastly moved to new ROR version and old version is being deprecated. So here I’ve show you what is on it. Before that below screenshot shows that how the old ROR 4 start page looks like . Because I loved that very much :-).

RUBY_ON_MY_MACHINE - Copy

Let’s rock on!

Here firstly I’ve fully removed ruby 1.8.7 and ROR 4 from my machine. After that I’ve installed ruby 2.2.4 and ROR 5.0.0.1

After that in the terminal I’ve issued the following command

>rails new first_app

So it creates a new rails app

Untitled

Oh looo..ong Screenshot 😀

After that move to that newly created rails app folder and issue the following command in the windows or linux terminal.

first_app>rails server

ROR2

After that type the following url in your web browser

http://localhost:3000/

Now you can see the browser screen as below.

ROR1

Yay 😀 it rocks !

The main difference is the welcome page is been changed and it’s clean and simple .Also the web server moved to “WEBRICK” to “PUMA”.

Thats it !

 

Finally upgraded to ROR 5 !

First step to groovy on windows

Hi , I’m already refreshing my knowledge about programming languages . I’m also java a lover . So when I searched about something about java and accidentally click on a link about java run-time environment based programming languages . Bingo…! bingo..! , it is a post on groovy . So  then I read that article and got some idea about groovy.

In this post I’will explain how to prepare the basic environment to run/develop groovy on windows 64 bit editions.

First thing is to  point to below url and download the windows setup binary

groovy-lang.org/download.html

pic_01

 

pic_02

Before this step you must have to install proper java SE development kit . I have installed  Java SE Development Kit 8u73 64bit edition ,

Now double click and run  the setup file

pic_04

pic_05

pic_06

pic_07

pic_08

pic_09

pic_10

In below step you will find that sometimes installer says unable to find jvm or JAVA_HOME . but ignore that and proceed to the next step.

pic_11

pic_12

pic_13

After finishing the setup you have to modify some settings as below . Open “Advance system settings” from the windows properties and click on “Environmental Variables”

pic_21

 

Then modify the settings according to the below screen shots

pic_20

pic_16

pic_18

Then you have to copy “groovy.exe” ,”groovyw.exe” from the folder “D:\Groovy2.4.5\Supplementary\native\64bit” to to the “D:\Groovy-2.4.5\bin” because we have to run 64 bit edition of groovy . Then give the permission to overwrite and replace the files

pic_22

After that move to the “D:\Groovy-2.4.5\Supplementary\JavaArch” folder using windows command prompt

pic_23

Then run the command “java  -jar GetArchModel.jar”

If the result is ok you will find the following message

“Found a 64 bit java installation.”

After that close the windows command prompt and then get a new command prompt window

Then type “groovy”

If the all the settings are successful you’ll find the following screen

pic_19

That’s all 🙂 !

Notice that if you are using 32 bit version of jdk and windows os  you don’t have to worry about copying “groovy.exe” ,”groovyw.exe” to the “D:\Groovy-2.4.5\bin” folder

If you have any comments let me know.It is very important!

Have a nice day 🙂 !

 

First step to groovy on windows