Skip to content

Commit

Permalink
Make the first usage example less confusing
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
rwz committed Jul 28, 2014
1 parent 53c5b22 commit 67c654e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ generation process is fraught with conditionals and loops. Here's a simple
example:

``` ruby
Jbuilder.encode do |json|
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at)

json.author do
json.name @message.creator.name.familiar
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
end
# app/views/message/show.json.jbuilder

if current_user.admin?
json.visitors calculate_visitors(@message)
end
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at)

json.comments @message.comments, :content, :created_at
json.author do
json.name @message.creator.name.familiar
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
end

json.attachments @message.attachments do |attachment|
json.filename attachment.filename
json.url url_for(attachment)
end
if current_user.admin?
json.visitors calculate_visitors(@message)
end

json.comments @message.comments, :content, :created_at

json.attachments @message.attachments do |attachment|
json.filename attachment.filename
json.url url_for(attachment)
end
```

Expand Down

0 comments on commit 67c654e

Please sign in to comment.