Author: admin
-
Rails Filters
Rails filters are methods that run before or after a controller’s action method is executed. They are helpful when you want to ensure that a given block of code runs with whatever action method is called. Rails support three types of filter methods: Before Filters Rails before filters are executed before the code in action…
-
Rails Layout
In Rails, layouts are pieces that fit together (for example header, footer, menus, etc) to make a complete view. An application may have as many layouts as you want. Rails use convention over configuration to automatically pair up layouts with respective controllers having same name. Rails layouts basically work on Don’t Repeat Yourself principle (DRY).…
-
Ruby on Rails Scaffolding
Scaffolding Scaffolding is a quick way to produce some major pieces of an application. For auto generating a set of models, views and controllers for a new resource in a single operation, scaffolding is used. Scaffolding is a technique supported by MVC frameworks in which programmers can specify how application database may be used. The…
-
Ruby on Rails Router
The Rails router recognizes URLs and dispatches them to a controller’s action. It also generate paths and URLs. Rails router deals URLs in a different way from other language routers. It determines controller, parameters and action for the request. Basically a router is a way to redirect incoming requests to controllers and actions. It replaces…
-
Ruby on Rails Migrations
Migrations are a way to alter database schema over time in a consistent and organized manner. They use a Ruby DSL through which there is no need to write SQL by hand. SQL fragments can be edited by hand but then you have to tell other developers about the changes you made and then run…
-
Ruby on Rails Bundler
In Rails, bundler provides a constant environment for Ruby projects by tracking and installing suitable gems that are needed. It manages an application’s dependencies through its entire life, across many machines, systematically and repeatably. To use bundler, you need to install it. The gem bundler bundles all the suitable gems your appication is based upon.…
-
Ruby on Rails RVM
RVM stands for Ruby Version Manager. It is a command line tool which allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them. RVM is maintained by the github community through pull requests sent to the project repository.…
-
Ruby on Rails MVC
Like most of the other frameworks, Rails is also based on MVC pattern. It basically works as following: Requests first come to the controller, controller finds an appropriate view and interacts with model which in turn interacts with database and send response to controller. Then controller gives the output to the view based on the…
-
Active Record
Data structures are represented by a hierarchy of classes. Data is mostly stored in relational database tables. There is an essential mismatch between your program’s object view and database’s relational data view. To remove this mismatch, many attempts have been tried. One way to resolve this mismatch was through the use of Object-relational-mapping (ORM) tools.…
-
Ruby on Rails Directory Structure
On creating a Rails application, the entire Rails directory structure is created. We will explain Rails 5 directory structure here. The jtp directory (shown below) has a number of auto-generated files and folders that comprises the structure of Rails application. We will explain the function of each of the files and folders present in the above directory.…