Skip to content

Instantly share code, notes, and snippets.

@shunwitter
Last active October 25, 2016 01:11
Show Gist options
  • Save shunwitter/721a26e95dababb97a0bde2bb57c67d9 to your computer and use it in GitHub Desktop.
Save shunwitter/721a26e95dababb97a0bde2bb57c67d9 to your computer and use it in GitHub Desktop.
Vuejs Simple Convention
# /api/my_api_controller.rb
class Api::MyApiController < Api::BaseController
def my_component_a_data
# Fetch data from rails and return json
@my_data_a = { title: 'Hello world', body: 'Vue.js is simple and easy to use.' }
render json: @my_data_a
end
def my_component_b_data
# Fetch data from rails and return json
render json: @my_data_b
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment