Ruby on Rails Installation

1. First of all  get the latest version of the Ruby from the internet (get  it here) . Get the latest version from here but you can first check the plugins you want to use and  which version that plugin support.

2. Get the latest version  on the database you want to use. As I am using MySQL so I  have just  mentioned how to install and from where to get the installer (get it here)

Sometime installation of  MySql us not very smooth specially if you have already installed it and then re-installing next time. in that case after uninstall make sure you delete the registry entry for the  MySql

I read here that to avoid hacking define a IP address for your site  in your my.ini.

e..g Add  bind-address=127.0.0.1 statement in the my.ini  [mysqId] section. Once change is done try this command

mysql.exe -h 127.0.0.1 -u root -p

and that will ask  you to  pass your mysql Password and show you the MySQl prompt.

3. To save a specific version you can use this command
e.g gem rails –version 3.0.4 –include-dependenciess

4. Install the mysql gem if you are using MySql db but if you are using some other DB then use that db gem.

gem install mysql

gem install mysql2

5. Once installations done for rails then create a new rails project as i am using 3.0.4 so I have used this command

rails new project_name (it will by default take sqlite db) to avoid that use

rails new myapp –database=mysql

6. Now change your directory to newly created project folder. but do not think that you are done  you still have more stuff to do.

as rails has created project  for you with the mysql db but you still need to go to config/database.yml and enter  the password information.

7. After this run command  rails db:migrate on the command prompt and  this will create  the tables in to the mentioned schema.

8. Once all the steps are completed run command “rails server” this will start your rails server. to terminate the server you can use Ctrl  + C

rails server

INSTALLATION OF SPREE (eCommerce)

If you are interested to use some other plugin like “spree” etc in that case there are independent steps but some are  common steps which I have shown above. I ran into alot of difficulty when I was trying to install the spree and I think almost by half a day has gone to figure out what’s wrong. As I did everything step by step as shown in the Spree website but still it was breaking whenever I was trying to get the files from spree git for sample projects. See how I have solved it I hope you might find it useful if you face same issue.

1. if you have already followed step (3), (4) and (5) then directly use the command

gem install bundler once completed then type command

2. on completion of the step 1 and then gem install spree and it will start installation of the spree.

3. Now you can create a new project where project name for example MyStore

rails new MyStore -d=mysql (when you select -d=mysql at that time database.yml will be generated for mysql db)

4. Mystore by command cd Mystore. Now change directory to MyStore.

5. follow these steps one by one if you want to start spree with the sample database and sample application which spree provides to get started.

Add the following lines to your Gemfile

gem ‘spree’

gem ‘spree_active_shipping’, :git => ‘https://github.com/spree/spree_active_shipping.git’

gem ‘spree_product_assembly’, :git => ‘git://github.com/spree/spree-product-assembly.git’

gem ‘spree_static_content’, :git => ‘git://github.com/spree/spree-static-content.git’

and after saving the GemFile run command Bundle Install you are lucky it will work without any issue but if things does not workout for you straight forward like me and show you some wierd error of file or directory not found. Then install the git gem or git installer on your machine.

As i faced this issue and then I thought about problem area and one which I could think of is the GitHub as i was not able to connect to the specified location of the git. So i installed msys

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: