Skip to content

Instantly share code, notes, and snippets.

@ramansah
Last active September 17, 2017 07:01
Show Gist options
  • Save ramansah/37e150100403a7888681102384a879d0 to your computer and use it in GitHub Desktop.
Save ramansah/37e150100403a7888681102384a879d0 to your computer and use it in GitHub Desktop.
def index
@articles = Article.all.to_json(
:only => [:id, :title, :status, :author]
)
end
def publish
article = Article.find(params[:id])
article.publish
render json: {
success: true,
article_status: article.status
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment