Coding Ruby?


Where and how can I code Ruby?

There are a multitude of HTML + CSS compilers on the internet, and several available for download... however I have found little to no services offering these benefits as they do for HTML and CSS.

Also.. How could I link Ruby to HTML? Let's say.. I have this HTML code;

<a href="#">Button</a>

But instead of the link not taking you anywhere, I wanted this Ruby code to be ran when the a element was clicked.

puts "Hello There";
response = gets.chomp;

Thanks in advance!


Hi, Ruby is typically used in the Back End.

What you see in a webpage is called the front end. That is basically HTML, CSS, and JavaScript.

HTML establishes the structure of the website, while CSS is used to determine the layout/visual -- the part that makes it pretty. Then JavaScript is used to control the behavior of the website and its elements. Essentially, the JavaScript is used to manipulate the DOM, the structure of the website (e.g. change HTML elements and their attributes, add/remove them, etc)

Now, for the Back End, that is where all the actual data is. Usually you have a database holding all the data for a website. That could be SQL or a NoSQL database like MongoDB. To communicate with that database in the server, you have the back end. In recent years, Ruby on Rails has become a popular technology for the back end (also called server-side). That is where you will typically be using Ruby.

So when you access a website, you get all the layout and stuff. That is the client side. But when you need data from the server -- the backend, you typically use AJAX to retrieve that data without reloading the whole webpage. So you, the client, would request some information from the server. The availability of that information is made possible after you have programmed the backend to deal with all these requests. Basically, you program in Ruby to determine what data to retrieve and what data to send back to the client. There is a lot going on about accessing/adding/removing data from a database in the backend. That is where you will be using Ruby: to connect to a database and perform some action based on what was requested from the client. Then, that information would be sent back according to your instructions -- whatever you programmed the server to do.

I hope that helps. There is a lot going on in a web application.