Skip to content

Commit

Permalink
remove variants paragraph indent in release notes. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Dec 4, 2013
1 parent 828a8f2 commit bad0386
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions guides/source/4_1_release_notes.md
Expand Up @@ -31,36 +31,36 @@ Major Features

### Variants

We often want to render different html/json/xml templates for phones,
tablets, and desktop browsers. Variants makes it easy.
We often want to render different html/json/xml templates for phones,
tablets, and desktop browsers. Variants makes it easy.

The request variant is a specialization of the request format, like `:tablet`,
`:phone`, or `:desktop`.
The request variant is a specialization of the request format, like `:tablet`,
`:phone`, or `:desktop`.

You can set the variant in a before_action:
You can set the variant in a before_action:

```ruby
request.variant = :tablet if request.user_agent =~ /iPad/
```
```ruby
request.variant = :tablet if request.user_agent =~ /iPad/
```

Respond to variants in the action just like you respond to formats:
Respond to variants in the action just like you respond to formats:

```ruby
respond_to do |format|
format.html do |html|
html.tablet # renders app/views/projects/show.html+tablet.erb
html.phone { extra_setup; render ... }
end
end
```
```ruby
respond_to do |format|
format.html do |html|
html.tablet # renders app/views/projects/show.html+tablet.erb
html.phone { extra_setup; render ... }
end
end
```

Provide separate templates for each format and variant:
Provide separate templates for each format and variant:

```
app/views/projects/show.html.erb
app/views/projects/show.html+tablet.erb
app/views/projects/show.html+phone.erb
```
```
app/views/projects/show.html.erb
app/views/projects/show.html+tablet.erb
app/views/projects/show.html+phone.erb
```

### Spring

Expand All @@ -86,6 +86,7 @@ bin/rails console
```

**spring introspection:**

```
$ bundle exec spring status
Spring is running:
Expand Down

0 comments on commit bad0386

Please sign in to comment.