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
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember HABTM' | |
| }); |
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
| class ApplicationController < ActionController::Base | |
| before_action :authenticate_user! | |
| private | |
| def authenticate_user! | |
| token = params[:token].presence | |
| @current_user = User.find_by(token: token) | |
| end | |
| 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
| { | |
| "people" : [ | |
| { | |
| "name" : "John Doe" | |
| }, | |
| { | |
| "name" : "Jane Doe" | |
| } | |
| ] | |
| } |
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
| [ | |
| { | |
| "name" : "John Doe" | |
| }, | |
| { | |
| "name" : "Jane Doe" | |
| } | |
| ] |
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
| module Medium | |
| class PostSerializer < ApplicationSerializer | |
| attributes :title, :description | |
| end | |
| end | |
| describe Medium::PostSerializer do | |
| let(:post) { build :post } | |
| subject { build_serializer post } |
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
| { | |
| "title" : "Hello World", | |
| "description" : null | |
| } |
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
| { | |
| "title" : "Hello World", | |
| "description" : "" | |
| } |
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
| module Medium | |
| class PostSerializer < ApplicationSerializer | |
| attributes :title, :description | |
| end | |
| end | |
| describe Medium::PostSerializer do | |
| let(:post) { build :post } | |
| subject { build_serializer post } |
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.class_eval do | |
| class << self | |
| delegate :row_to_json, to: :all | |
| end | |
| end | |
| ActiveRecord::Relation.class_eval do | |
| def row_to_json | |
| '[' + row_to_json_result.values.join(',') + ']' | |
| 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
| class MyController < BaseController | |
| def index | |
| super MyModel | |
| end | |
| end |