diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/asset_pipeline.md | 27 | ||||
-rw-r--r-- | guides/source/migrations.md | 8 |
2 files changed, 31 insertions, 4 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 39448e92d5..77189e1442 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -577,6 +577,33 @@ would generate this HTML: The `body` param is required by Sprockets. +### Runtime Error Checking + +By default the asset pipeline will check for potential errors in development mode during +runtime. To disable this behavior you can set: + +```ruby +config.assets.raise_runtime_errors = false +``` + +When `raise_runtime_errors` is set to `false` sprockets will not check that dependencies of assets are declared properly. Here is a scenario where you must tell the asset pipeline about a dependency: + +If you have `application.css.erb` that references `logo.png` like this: + +```css +#logo { background: url(<%= asset_data_uri 'logo.png' %>) } +``` + +Then you must declare that `logo.png` is a dependency of `application.css.erb`, so when the image gets re-compiled, the css file does as well. You can do this using the `//= depend_on_asset` declaration: + +```css +//= depend_on_asset "logo.png" +#logo { background: url(<%= asset_data_uri 'logo.png' %>) } +``` + +Without this declaration you may experience strange behavior when pushing to production that is difficult to debug. When you have `raise_runtime_errors` set to `true`, dependencies will be checked at runtime so you can ensure that all dependencies are met. + + ### Turning Debugging Off You can turn off debug mode by updating `config/environments/development.rb` to diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 71a177bca7..5d5c2724b1 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -297,10 +297,10 @@ You can append as many column name/type pairs as you want. You can also specify some options just after the field type between curly braces. You can use the following modifiers: -* `limit` Sets the maximum size of the `string/text/binary/integer` fields -* `precision` Defines the precision for the `decimal` fields -* `scale` Defines the scale for the `decimal` fields -* `polymorphic` Adds a `type` column for `belongs_to` associations +* `limit` Sets the maximum size of the `string/text/binary/integer` fields. +* `precision` Defines the precision for the `decimal` fields, representing the total number of digits in the number. +* `scale` Defines the scale for the `decimal` fields, representing the number of digits after the decimal point. +* `polymorphic` Adds a `type` column for `belongs_to` associations. * `null` Allows or disallows `NULL` values in the column. For instance, running: |