$ rails g model User
belongs_to
has_one
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| # Chinese (China) translations for Devise 2.0 | |
| # by HungYuhei (https://github.com/HungYuHei) | |
| # forked from https://gist.github.com/1319590 | |
| zh-CN: | |
| errors: | |
| messages: | |
| expired: "您已过期,请重新申请" | |
| not_found: "没有找到" | |
| already_confirmed: "已经激活,请重新登录." |
I've been using this technique in most of my Ruby projects lately where Ruby versions are required:
.rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far....rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.
| # From the project root | |
| rvm env -- `rvm current` >> .powenv |
| // The API accepts the page parameter and returns the pagination info in meta | |
| { | |
| "messages": [ ... ], | |
| "meta": { | |
| "pagination": { | |
| "total_pages": 3, | |
| "current_page": 1, | |
| "total_count": 55 | |
| } |
| // Future versions of Hyper may add additional config options, | |
| // which will not automatically be merged into this file. | |
| // See https://hyper.is#cfg for all currently supported options. | |
| module.exports = { | |
| config: { | |
| // default font size in pixels for all tabs | |
| fontSize: 14, | |
| // font family with optional fallbacks |
| Web.Store = DS.Store.extend(); | |
| DS.WebsocketAdapter = DS.RESTAdapter.extend({ | |
| callbacks: {}, | |
| socket: null, | |
| beforeOpenQueue: [], | |
| ajax: function(url, type, params) { | |
| var adapter = this; | |
| var uuid = adapter.generateUuid(); |