Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|Last
Lessons:- Debug and Rails Environments

This introduces the Sass mixin facility, in this case called box_sizing. A mixin allows a group of CSS rules to be packaged up and used for multiple elements, converting

.debug  dump  {
.
.
.

@include box sizing;
}

 

 to

.debug dump {
.
.
.

-moz-box-sizing:   border-box;
-webkit-box-sizing:  border-box;
box-sizing:  border-box;
}

 

  We’ll put this mixin to use again in Section 7.2.2. The result in the case of the debug box is shown in Figure 7.3. The debug output in Figure 7.3 gives potentially useful information about the page being rendered:

 

- - -
controller: static pages
action: home

 

 

 

This is a YAML3 representation of params, which is basically a hash, and in this case identifies the controller and action for the page. We’ll see another example in Section 7.1.2

                  Since we don’t want to display debug information to users of a deployed application, Listing 7.1 uses

 

if  Rails.env.development?

              

to restrict the debug information to the development environment, which is one of three environments defined by default in Rails (Box 7.1).4 In particular, Rails.env.development? is true only in a development environment, so the Embedded Ruby

<%=  debug(params)  if  Rails .env.development?  %>

won’t beinserted into production applications or tests. (Inserting the debug information into tests probably wouldn’t do any harm, but it probably wouldn’t do any good, either, so it’s best to restrict the debug display to development only.)

 

 

 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)