Search code examples
ruby-on-railsrubypreview

How to preview rails?


A website is shared to me on github. I'm working on it, but I can't do modifications on the actual site page yet. I need to see how the changes I make look like.

How can I have a live preview from rails? I was used to use xampp for the html/css stuff. Is there anything similar to that? If not, what are my choices?


Solution

  • The usual workflow is to setup a development environment on your local machine. The tools you will need for this are roughly:

    • git, to clone the github repository to your local machine
    • ruby (what version you need depends on the project), preferably you use a version manager such as rvm or rbenv
    • the correct database (again depending on your project, e.g. mysql or postgresql)

    Once you have a ruby version installed, the first step will be to run 'bundle' to install all dependent ruby libraries. If that was successful you can configure your database in a file that either exists already or should be added: config/database.yml in which you configure the database connection.

    You would use the command 'rake db:create db:migrate' to setup the database according to the projects migrations (=> specifying the database layout).

    You might want to make yourself a bit familiar with ruby on rails, by following some good beginners tutorial. In the official rails guides that would be: http://guides.rubyonrails.org/getting_started.html

    It is not as 'out-of-the-box' as you might be used to from xampp , so there might be a bunch of pitfalls in the way (especially if you're running on windows and not linux / mac).

    It is hard to give you a complete walkthrough without knowing the application and your system.

    Depending on who's developing the application you might also ask them to provide you with a VM, e.g. using a tool called 'vagrant' to simplify the setup for you. You will still need to get more familiar with git, in case you aren't yet.