`
peryt
  • 浏览: 54412 次
  • 来自: ...
最近访客 更多访客>>
社区版块
存档分类
最新评论
  • waiting: 既然都指定了dataType为'script'那就不必特别在b ...
    jQuery

6.3 add some debug info to the layouts, rails environment.

 
阅读更多

 

<html>
  <body>
    <div class="container">
      <%= render 'layouts/footer'%>
      <%= debug(params) if Rails.env.development? %>
    </div>
  </body>
</html>

 

since we don't want to display the debug info to a deployed application, we use 

 

if Rails.env.development?

 

to restrict the debug info to dev environment.

 

(rails console   ---------------> this will start as dev environment)

(rails console test   ---------------> this will start as test environment)

(rails console production   ---------------> this will start as production environment)

 

(rails server    )

(rails server --environment product     )

(rails server --environment test    )

 

(rake db:migrate RAILS_ENV=production    )

(rake db:migrate RAILS_ENV=test)

 

(it is confusing that the three command are using diff format to specify env, worth to remember it.)

 

 

also, if you are using heroku, you can also start heroku console:


heroku console


Rails.env

====> "production"

Rails.env.production?

====> true

 

 

 

 

分享到:
评论

相关推荐

    Ruby_on_Rails实践.rar

    除此之外,Rails还引入了一些设计模式,如资源路由(Resourceful Routing)、部分视图(Partials)和布局(Layouts)。资源路由使你可以用简洁的语法定义CRUD操作,部分视图用于代码重用,布局则可以创建页面的通用...

    Debugging with GDB --2007年

    Stepping to the next line in the source program . . . . . . . . . . . . Stepping into a subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Examining the Stack . . . . . . . . . ....

    Flexalon Pro 3D UI Layouts v4.0.0.unitypackage

    Flexalon Pro 3D UI Layouts v4.0.0

    Deep_Space_Optical_communications_2

    1.12 The Future................................................................................................ 52 1.12.1 Optical Communications Telescope Facility (OCTL) ............... 52 1.12.2 ...

    python3.6.5参考手册 chm

    Changes to the Handling of Deprecation Warnings Python 3.1 Features PEP 372: Adding an Ordered Dictionary to collections PEP 378: Format Specifier for Thousands Separator PEP 389: The argparse ...

    MySQL 5.6 Reference Manual

    Table of Contents Preface, Notes, Licenses . . . . . . . . ....1. Licenses for Third-Party Components ....1.1. FindGTest.cmake License ....1.2. LPeg Library License ....1.3. LuaFileSystem Library License ....

    odoo themes

    It supports a variety of tags and expressions that make it easy to manipulate data and generate complex layouts. 4. **Menus and Views**: These components define the navigation structure and the ...

    eric5-5.3.1

    must configure the Python interpreter and the Debug Client to be used in the Preferences dialog. eric5 includes two different versions of the debug client. DebugClient.py is the traditional ...

    Android.Programming.The.Big.Nerd.Ranch.Guide.2nd.Edition.0134171454.epub

    Each chapter and app has been designed and tested to provide the knowledge and experience you need to get started in Android development. Big Nerd Ranch specializes in developing and designing ...

    Modern Auto Layout.zip

    How to add identifiers to views and constraints Ambiguous layouts - tell me more! Using the view debugger Private debug methods - keep them to yourself. Layout loops...layout loops...layout loops

    bootstrap_example:Bootstrap + Rails 4.x 示例

    在结合Rails 4.x这样的Ruby on Rails框架时,Bootstrap能够极大地提升Web应用的用户体验和视觉吸引力。 本示例"bootstrap_example"旨在展示如何在Rails 4.x应用程序中有效地整合Bootstrap。Rails 4.x是Ruby on ...

    Android.application.development

    This tutorial will teach you basic Android programming and will also take you through some advance concepts related to Android application development. This book will help you Table of Contents ...

    Mastering Backbone.js(PACKT,2015)

    From organizing your code in a logical and physical way, you will go on to delimit view responsibilities and work with complex layouts. Synchronizing models in a two-way binding can be difficult and...

    thymeleaf Examples: Layouts

    Thymeleaf Examples: Layouts ...This is an example project containing code used in the "Thymeleaf Layouts" tutorial. The project was created using Spring MVC 4 Quickstart Maven archetype: ...

Global site tag (gtag.js) - Google Analytics