Skip to content

Instantly share code, notes, and snippets.

View aElizabethU's full-sized avatar

Amber Urbahns aElizabethU

View GitHub Profile
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
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
##Userable
module Userable
def self.included(base)
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true
base.validate :user_must_be_valid
base.alias_method_chain :user, :autobuild
base.extend ClassMethods
base.define_user_accessors
end

Rails Models

Generating models

$ rails g model User

Associations

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
@aElizabethU
aElizabethU / zurb-foundation-application.html.haml
Created April 14, 2014 21:00
zurb-foundation-application.html.haml
!!!
/ paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
/[if lt IE 7 ] <html class="ie6" lang="en">
/[if IE 7 ] <html class="ie7" lang="en">
/[if IE 8 ] <html class="ie8" lang="en">
/[if IE 9 ] <html class="ie9" lang="en">
/ [if (gt IE 9)|!(IE)]><!
%html{lang: "en"}
/ <![endif]
%head
<!-- Header and Nav -->
<div class="row">
<div class="large-12 columns">
<div class="panel">
<h1>Feed Template</h1>
</div>
</div>
</div>
<!-- End Header and Nav -->
<!-- Nav Bar -->
<div class="row">
<div class="large-12 columns">
<div class="nav-bar right">
<ul class="button-group">
<li><a href="#" class="button">Link 1</a></li>
<li><a href="#" class="button">Link 2</a></li>
<li><a href="#" class="button">Link 3</a></li>
<li><a href="#" class="button">Link 4</a></li>