What's the Differences Between Ruby on Rails and Ruby

What is the difference between Ruby and Ruby on Rails?

Ruby is a programming language. Ruby on Rails ("RoR") is a web-application framework that is implemented in Ruby.

So they not only "work together" but RoR depends on Ruby.

What is difference between Ruby and Ruby on Rails?

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.

Ruby vs. Ruby On Rails

Rails is a framework for building web applications with Ruby. Ruby is a general purpose programming language. Yes, Rails is analogous to Django.

What is the difference between %= ... % and % ... % in Ruby on Rails

This is ERB templating markup (one of many templating languages supported by Rails). This markup:

<% ... %>

is used to evaluate a Ruby expression. Nothing is done with the result of that expression, however. By contrast, the markup:

<%= ... %>

does the same thing (runs whatever Ruby code is inside there) but it calls to_s on the result and replaces the markup with the resulting string.

In short:

<% just run code %>
<%= run code and output the result %>

For example:

<% unless @items.empty? %>
<ul>
<% @items.each do |item| %>
<li><%= item.name %></li>
<% end %>
</ul>
<% end %>

In contrast, here's some Haml markup equivalent to the above:

- unless @items.empty?
%ul
- @items.each do |item|
%li= item.name

Ruby and Rails or Ruby on Rails

The name "Ruby on Rails" is sometimes shortened as "Rails", or "RoR", which is the same - a web development framework.

You can, of course, use Ruby without Rails, as you can use any other programming language, to build different programs, not only web applications.

You cannot use Rails without using Ruby, because as you wrote yourself, Rails is a web framework built in Ruby. When you build web applications in Rails, you write your code in the Ruby language (there are some other rewrites of Rails, like GRails, which uses Groovy, but this is a different thing).

If you follow the installation guide on the Get Started page, you will see that you first install Ruby for your platform, then install RubyGems (which is a package manager for installing additional Ruby libraries), and then use RubyGems gem install rails command to install Rails with all its dependencies. So you might say that Rails is a library for Ruby.

This installation of Rails then provides a set of scripts, including the rails command, which help you build your web application according to the set of conventions adopted by Rails.

JRuby on Rails vs. Ruby on Rails, what's difference?

The original answer still stands and isn't really time specific. JRuby is just a version of Ruby that runs on the Java Virtual Machine (JVM). If you're starting from scratch, just go for plain Ruby. JRuby is mostly useful to people who have existing Java code and would like their JRuby and Java apps to communicate.

What are the major differences between Rails 1.X and 2.X

One of my favorite books is the "skateboard" book from The Pragmatic Programmers, "Agile Web Development with Rails". Many of the things that have changed were moved from core into plugins, so if they are features that you want or need, then you can still use them. Most of the new features were adding, rather than removing things.

As mentioned in other comments, to find out more you can visit these links:

  • http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release
  • http://www.infoq.com/news/2007/12/rails-20-docs

That said, I also have "The Rails Way" by Obie Fernandez which covers Rails 2.0. However, I still find myself reaching for the Agile book more often. You can get it, and the soon-to-come 3rd Edition here: http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition.

Because development on Rails is so fast paced, it is very difficult for books to actually keep up with the framework. I find that reading blogs is the best way to stay abreast of new features that have been added or to find out about not-new features that I didn't know about.

Some of the blogs that I subscribe to (there are many, many more available than these):

  • http://weblog.rubyonrails.com/
  • http://delicious.com/jnunemaker/railstips
  • http://railstips.org/
  • http://blog.hasmanythrough.com/
  • http://ryandaigle.com/
  • http://railspikes.com/
  • http://www.railsontherun.com/
  • http://agilewebdevelopment.com/plugins

What is the difference between :to and = in rails

In context of Rails routes:

  • Is there a difference between these two statements?

There is no difference.

  • If so why is one better than the other?

No, it's the same.

  • Why is the rails community switching to the ":" notation (or are
    they)?

Just a more readable, 'from' => 'to' and 'from', to: 'to'

  • Moving forward with rails 4 and soon 5, are both formats still
    acceptable?

Yes.

The => notation it's a hash ruby feature, and related to the :symbol.
You can write symbols by two ways :key => value and key: value.



Related Topics



Leave a reply



Submit