Last active
December 31, 2015 05:39
-
-
Save ascsystems/7942727 to your computer and use it in GitHub Desktop.
Can access all json params but "ranges"
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 AnnotationsController < ApplicationController | |
| def index | |
| annotations = Annotation.all | |
| render json: annotations | |
| end | |
| def show | |
| annotation = Annotation.find(params[:id]) | |
| render json: annotation | |
| end | |
| def new | |
| annotation = Annotation.new | |
| render json: annotation | |
| end | |
| def edit | |
| annotation = Annotation.find(params[:id]) | |
| end | |
| def create | |
| annotation = Annotation.create(quote: note_params['json']['quote'], text: note_params['json']['text'], ranges: note_params['json']['ranges']) | |
| if annotation.save | |
| render json: annotation, status: :created | |
| else | |
| render json: annotation.errors, status: :unprocessable_entity | |
| end | |
| end | |
| def update | |
| annotation = Annotation.find(params[:id]) | |
| if annotation.update_attributes(params) | |
| head :no_content | |
| else | |
| render json: annotation.errors, status: :unprocessable_entity | |
| end | |
| end | |
| def destroy | |
| annotation = Annotation.find(params[:id]) | |
| annotation.destroy | |
| head :no_content | |
| end | |
| private | |
| def note_params | |
| params.permit! | |
| 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
| {"json"=>"{\"ranges\":[{\"start\":\"/div[3]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[4]/div[1]/div[4]/div[2]/p[1]\",\"startOffset\":1130,\"end\":\"/div[3]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[4]/div[1]/div[4]/div[2]/p[1]\",\"endOffset\":1295}],\"quote\":\"se, and they played instrumental solos at breakneck speeds and used special techniques to be able to play as quickly as possible. The group’s lineup in the 1980s con\",\"text\":\"testing\"}", "action"=>"create", "controller"=>"annotations"} |
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
| {"ranges":[{"start":"/div[3]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[4]/div[1]/div[4]/div[2]/p[2]","startOffset":795,"end":"/div[3]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[4]/div[1]/div[4]/div[2]/p[2]","endOffset":884}],"quote":"htly against the strings, which creates a \"chugging,\" percussive sound. Palm muting allow","text":"test"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment