
Search In
Module is one of the most important tool in the Ruby toolbox. They are generally used to namespace ruby classes.
module Test
class Hello
end
end
The class Hello will be wrapped in the Test namespace which means that if we want to create an ins
SQL Server has an exception model to handle exceptions and errors that occurs in SQL statements. To handle exception in Sql Server we have TRY..CATCH blocks. In Sql Server, against a Try block we can have only one CATCH block.
Ex;
BEGIN TR
Has_one and Belongs_to relationship sometime become confusing so the main difference can be explained with the help of example:
1>Has_one :-
class Department < ActiveRecord::Base
has_one: employee
end
this means that employee table has a for
"Fat models, skinny controllers" has been the design style for Rails app development. However, with time this style has been outdated as with code growth the models become too fat to handle.
Why not use concerns?
ActiveSupport concern ca
One of the most powerful feature in ruby is module. Modules are like classes but can not instantiated. Module is used for two purpose:
1. namespacing
2. mixin
Namespacing
A class per can be wrapped inside a module to avoid collisio
Use of Super Keyword and Mixins In Ruby
Super Keyword
Ruby gives us with a built-in function called super that allows us to call methods which are present in its super class.
The use of inheritance is to make the overridden methods in a subc
For an application we need some authorization method, Policies in rails is one of them.
There is one library Pundit used for authorization.
Pundit gem uses object oriented design and Ruby classes.
To start with add this gems into your Gemfile and ru
In Self join association one model has relation with itself. For example one user table can have list of all coach and player. One coach can train many players. We will represent the association as:
class User < ActiveRecord::Base
has_many :pl
Output buffering is mechanism in which sending a response to the browser . Without output buffering (the default) you HTML is send to the browser in pieces as php script . With output buffering your HTML is store in a variable and send to the brows
Call a procedure with in procedure in SQL server :-
While working in sql Some times you need to Calling one stored procedure within another stored procedure. So you can implement this using below sample code:---
//Store Procedure 1
CREATE PROCEDUR
