Ruby on Rails.

Ruby on Rails.

Description of tag Ruby on Rails

An analysis of why Ruby on Rails is the best web-development framework

Ruby on Rails, often simply called Rails, is a web application framework written in Ruby. It was created by David Heinemeier Hansson and released in 2004. Rails is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows developers to write less code while accomplishing more than many other languages and frameworks.

How to manually execute a SQL query in Ruby on Rails

I run into this just now. The wrong way: 

results = ActiveRecord::Base.connection.execute("select * from users limit 10")

The right way: 

results = ActiveRecord::Base.connection.exec_query("select * from users limit 10") 

Somehow the formet executes the query without returning a result. If you want to actually see the results of SELECT'ing something, use the latter query. (Which also means that you probably want to use the former for INSERT'ing, though I have not verified.)

Ruby on Rails: allow parameters to have “.” (dot)

By default, dot in rails router is used to separate the format from the rest of the url. To allow dot in a parameter, override the constraint. The below example allows any character except slash:

get "/:user/contributions" => 'users#contributions', :constraints => { :user => /[^\/]+/ }

Ruby on Rails naming conventions

Ruby on Rails, often referred to as Rails, follows a set of naming conventions to maintain consistency and readability in code. I generally like RoR conventions and follow them. Here's a summary of some key naming conventions in Ruby on Rails:

Class Names: Class names in Rails are typically in CamelCase (also known as PascalCase), starting with an uppercase letter. For example, User, ProductCategory, or OrderDetail.