I've looked up plenty of information on Rails, but I still can't say I'm quite sure of what it is. If I'm developing a web app, what functionality would I get that I couldn't from html/js/php? Would every project benefit from rails, or do you need a certain goal in mind?
Ruby on Rails is a web application framework. Technically there isn't anything that Rails can do that HTML/JS/PHP can do. The point of Rails it to make developing websites easier, faster, and hopefully more maintainable. If you are familiar with PHP, then Rails is somewhat equivalent to Symfony, Kohana or Yii.
I'd recommend trying out some of these tutorials if you haven't already.
Rails for Zombies - you won't even have to setup rails on your machine
Ruby on Rails tutorial book
Railscasts - for once you get more into it
Ruby on Rails is a web framework built for programmer productivity and happiness. It's built on top of the Ruby language which means you get access to all the cool libraries ("gems") other people have written such as file upload libraries and ones that interact with web services such as AWS.
You use HTML and JavaScript with it just like you would in every other web framework out there. The difference? It's not built on top of a hack of a language such as PHP. Good Ruby code is elegant and very readable, and you will find this out in your usage of the framework.
The Getting Started guide explains it very well: http://guides.rubyonrails.org/getting_started.html.
What it is is a framework. It's a set of APIs, a toolkit if you may, to build web applications.
Ruby is a programming language like Python, Perl, C, C++, Java, C#, PHP etc. It's closer to Perl and Python than to other due to its interpretive nature (a scripting language if you may).
RubyOnRails is a framework built on top of Ruby to build web apps. Arguably like Servlets is used to build web apps on Java or .Net is used on C#, or Django on Python or CakePHP on PHP etc. It's an amalgamation of APIs, code generation tools, testing code etc put together.
It's popular because of it's elegance, it's choice of following conventions over configuration (you write less config code or glue code). Once you get the hang of it, there is less ceremony involved before you get from idea in your head to working production application with RubyOnRails (popularly referred to as Rails).
Related
I started learning rubyonrails but I heard about Angular.js.
Any alternative or it is compulsory to learn with rubyonrails.
or I can develop webapps without angular.js
Ruby on Rails and Angular.js are two different things. Ruby on Rails is a framework for the server side of a web application written in Ruby, Angular.js is a javascript framework for the client side of a web application. They can be used independently, or together.
This is a fairly broad question, however I'll give some general information on Angular's role within a Rails context, as well as brief info on what else is out there.
AngularJS is not required to develop web apps with Ruby on Rails. Rails is its own framework, one that handles both front end and back end functionality. In fact, to use Angular with Rails, you'd have to prevent Rails from handling the front-end aspect, and have it act as an API provider which Angular would then use to provide an interface.
Angular is a front-end framework - it is generally used to hook up to a backend like Rails, and the two can work in conjunction, though it's certainly not required. You're able to build out full applications in Rails entirely, and can build Angular applications without ever touching Rails. This being said, Angular is not the only framework of its kind, there are several great ones out there:
Backbone.js - a library which provides a ton of flexibility for the developer in how to structure their app; it's fairly non opinionated and depending on your style that can be either great or not so great.
Ember.js - a "framework for creating ambitious apps", as put in Ember's own words. It's an opinionated framework, and if you're experienced in Rails you'd definitely see similarities between the two frameworks in terms of conventions.
React.js - a JS library for building user interfaces - it's basically like the V in the MVC framework, handling only the views.
There's no need to learn any of these to be able to use Rails to build fully functional apps. If you want to build snappy single page applications, then learning to use/integrate one of the front-end frameworks/libraries with Rails would be a good idea.
Hope it helps!
Some ruby gems like jekyll, toto and webby offer out of the box blog-type integration into your ruby app. Another way of developing a rich web blog-type application is to build and model the application yourself using pure ruby and rails practices. (e.g creating an Article and User model). The first offers out of the box features the 2nd option offers more customization and control.
In people's experience on Stack Overflow, which would be the best route and what would people consider when making the decision to use a gem out of the box versus going alone?
All of the gems you mentioned take static, markdown/textile/etc files and turn them into HTML websites. They take different approaches to it, with jekyll spitting out the finished website for hosting, toto doing the converting and routing on request, and webby doing the same as jekyll mostly.
If you're using Rails, it's important to note that none of these will integrate into your application well. They're built to more-or-less operate on their own.
Generally speaking, if a gem has the functionality you need, use it. They are not equivalent to plugins you find for Wordpress and Drupal where they are typically low-quality, buggy, poorly documented, etc. More often than not, gems simply add a couple modules that you can integrate into your application how you like.
On the other hand, a basic blog is pretty quick and simple in Rails, especially considering you've got a handy walkthrough guide straight from the Rails documentation on how to do it.
If you're new to Rails and want tight integration with your app, it's probably best to bake your own blog features.
This will take some time to do, but its worth it to learn how things really work.
If you're more seasoned, just look at the gem's API and documentation and decide if it does what you want it to do and if you're comfortable with how to integrate it. If so, it'll save you time.
One other consideration: who will be using the blog? Is it for internal use, and programmers will be the ones updating it? If that's the case, then you can make it very easy by not worrying about a lot of aesthetic polish in the back-end. Conversely, if you're making an app that includes a blogging component for the general public you might want it to feel more polished. In this case a gem might save you a lot of time.
It depends on your application.
What is difference between Ruby and Ruby on Rails? OK, I know that Ruby on Rails is a Web app framework that is built on the scripting language Ruby.
But why are there options on godaddy.com to choose hosting for Ruby and hosting for Ruby on Rails?
Would it be the same to put hosting for C# and for asp.net?
You can check it here
Well I would guess it's a marketing thing/trick as far as GoDaddy is concerned.
There are other frameworks written in Ruby besides Rails, Sinatra for example, and you can very well write your web applications without framework (your own server, does exactly what you need it to do).
Although, all of that, including Rails, can be named Ruby hosting.
Krule's on the money. The difference is between a language and a framework. Ruby, the programming language, can be used to support any number of web and application frameworks.
By their wording, it's safe to say that it's more of a marketing reason using the ruby on rails buzz word.
Other than that it could mean default support for all the necessary tools for common ruby on rails development scenarios.
I've been learning the Ruby web framework Sinatra lately, and I'm finding it great to use. Most of the articles and blogs I have read about it seem to assume that it is good only for small websites, or 'tiny' web-apps. Is this true? Can a complete web application be built in Sinatra, or is Ruby on Rails the way to go?
You could, in theory, build an entire web application using Sinatra, and it would offer you more precision control than Ruby on Rails would.
That said, it also removes all of the nice features ruby on rails gives you, such as the Model-View-Controller architecture.
If you're looking to build a web application with database interaction, I strongly advise you use Ruby on Rails.
If you're looking to build a very simple API or something that just takes some data and throws it up onto Twitter or something, go ahead and use Sinatra.
There is no reason that it couldn't be used to build an enterprise website. It's fast and intuitive. Two key things in building a larger web application. While it does lack many of the features of Rails, I am yet to run into a road block.
I personally like the slim nature of Sinatra. It embraces routing instead of making it a headache.
I usually find myself wrestling with Rails, whereas I configure Sinatra to my liking.
As for database interaction, mongo_mapper + Sinatra works very well.
I am developing an application in using Ruby on Rails, mostly as an excuse to learn the language.
This is not intended to be a web-based application - and perhaps I have chosen the wrong language, but...
My understanding is, that in order to run an instance of this application on somebody else's computer, they would need to install ruby on rails, and a webserver (or webrick, perhaps), as well as my application code.
I am just curious if there are any other options for distributing my application as a standalone app, or perhaps just a simple way to package up a web browser and ROR together with my app for a simple, one-step install?
I have personally never needed to do this. But, I have ran across this tutorial http://www.erikveen.dds.nl/distributingrubyapplications/rails.html that I think will be helpful. The tutorial covers how to actually convert a rails app into a standalone exe file.
Note, Slingshot appears to be a dead project (see comments). I'll leave this answer here for historical purposes and the off-chance that it comes back
Joyent's Slingshot might be a good bet.
Joyent Slingshot allows developers to deploy Rails applications like a standard desktop application, which work online and offline (with synchronization), have drag and drop, and interact with all the other desktop applications.
With Joyent Slingshot:
Create a hybrid Web/desktop application
Synchronize online and offline data
Use the same code for online and offline application(s)
Deploy and update your application easily
Drag into and out of application
Here are some further links to help with your evaluation and/or to help you get started:
Introducing Joyent Slingshot
Basic application walkthrough
Slingshot wiki
The way most people ship ruby programs, including Rails webapps, as a standalone exe is via rubyscript2exe. They describe how to package a Rails application at http://www.erikveen.dds.nl/distributingrubyapplications/rails.html. Ruby, Rails, and all the associated libraries will be included in the EXE file.
As others mentioned, Ruby is not necessarily Rails and if you really want an easy way to write a distributable GUI application in Ruby, Shoes is an excellent place to start looking.
Gears on Rails maybe?
You could always consider compiling your Ruby to JVM byte-code (via JRuby) or .NET byte-code (via IronRuby) to distribute to people who have those virtual machines and don't want to install a Ruby runtime.
You might want to check out Shoes for building desktop applications in Ruby. Rails really is tuned for building websites.
You can include Ruby on Rails by freezing it to the version of Rails you want to use in your project. They call this Freezing. The user will not have to install Rails to use your application. You can do this with any library you use in your project. If the project uses a library, just place it under the Vendor folder in your project. Then use a tool similar to what #Josh answered with to package it.
You will need a web server to run the project though. There is no way around this. Ruby on Rails is just like ASP.NET in this regard, in that it is a server side framework. The server runs the code and outputs the HTML to the browser by using the Rails framework.
Unfortunately, you may have picked the wrong framework to do what you want. Instead of Ruby on Rails, you may want to check out Shoes, which is a framework for developing GUI applications using Ruby.
You do not specifically say whether it is supposed to be a GUI application or not. From the other answers, I would guess so.
Therefore, you need to clarify what your goals are. RoR is a specialized framework for web applications. If your goal is to learn RoR, I'd say to get yourself some inexpensive web hosting and make yourself an app. If your goal is to learn Ruby, not necessarily Rails, then Shoes, IronRuby, JRuby, MacRuby and others may be good options to look at.