This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def edge_case | |
| render :json => @users.as_json(:only => [:first_name, :state]) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{ | |
| "roles": [{ | |
| "name": "Admin" | |
| }], | |
| "city": "Boulder", | |
| "employers": [{ | |
| "title": "Quick Left" | |
| }], | |
| "state": "CO", | |
| "full_name": "Collin Schaafsma" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActiveRecord::Base.include_root_in_json = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{ | |
| "user": { | |
| "roles": [{ | |
| "name": "Admin" | |
| }], | |
| "city": "Boulder", | |
| "employers": [{ | |
| "title": "Quick Left" | |
| }], | |
| "state": "CO", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def as_json(options={}) | |
| super(:only => [:city,:state], | |
| :methods => [:full_name], | |
| :include => { | |
| :employers => {:only => [:title]}, | |
| :roles => {:only => [:name]} | |
| } | |
| ) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def full_name | |
| "#{first_name} #{last_name}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{ | |
| "user": { | |
| "roles": [{ | |
| "name": "Admin" | |
| }], | |
| "city": "Boulder", | |
| "last_name": "Schaafsma", | |
| "employers": [{ | |
| "title": "Quick Left" | |
| }], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def as_json(options={}) | |
| super(:only => [:first_name,:last_name,:city,:state], | |
| :include => { | |
| :employers => {:only => [:title]}, | |
| :roles => {:only => [:name]} | |
| } | |
| ) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def index | |
| render :json => @users | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem install prologue | |
| prologue new my_awesome_app |