This file contains 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
# `name` is a symbol used as a key of the object described by `prefix`. | |
# `template` is the name of the partial (from view/ and without the _). | |
# `locals` are the local variables accessible in the template. | |
def seed_data(name, template, locals, prefix = 'window.Seeds') | |
partial = { partial: template, locals: locals, handlers: [ :jbuilder ], formats: [ :json ] } | |
json = render(partial, locals) | |
key = "#{prefix}.#{name}" | |
code = "#{key} || (#{key} = {}); #{key} = #{json};" | |
javascript_tag { raw(code) } |
This file contains 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
vehicle_templates_new GET /vehicle_templates/new(.:format) vehicle_templates#new | |
root / application#home | |
dashboard GET /dashboard(.:format) application#dashboard | |
sessions POST /sessions(.:format) sessions#create | |
session DELETE /sessions/:id(.:format) sessions#destroy | |
facebook_sessions POST /facebook_sessions(.:format) facebook_sessions#create | |
facebook_sessions_callback GET /facebook_sessions/callback(.:format) facebook_sessions#callback | |
user_confirm GET /users/:user_id/confirm(.:format) users#confirm | |
user |
This file contains 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
(function() { | |
jQuery(function() { | |
var $uploader; | |
$uploader = $('#uploader'); | |
if ($uploader.length) { | |
$uploader.fileupload({ | |
url: $uploader.attr('action'), | |
formData: { | |
token: $uploader.data('token') |
This file contains 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
ig | |
.module('game.entities.ui.pointer') | |
.requires( | |
'impact.entity' | |
) | |
.defines -> | |
window.EntityPointer = ig.Entity.extend | |
checkAgainst: ig.Entity.TYPE.BOTH | |
size: |
This file contains 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
ig | |
.module('game.entities.shield') | |
.requires('impact.entity') | |
.defines -> | |
window.EntityShield = ig.Entity.extend | |
collides: ig.Entity.COLLIDES.NEVER | |
type: ig.Entity.TYPE.B | |
checkAgainst: ig.Entity.TYPE.B | |
size: |
This file contains 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
<%= form_for @topic do |f| %> | |
<%= debug f.object.error_messages %> | |
<p> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</p> | |
<%= fields_for @post do |ff| %> | |
<p> | |
<%= ff.label :content %><br /> |
This file contains 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 TopicsController < ApplicationController | |
def index | |
@topics = Topic.all | |
end | |
def show | |
@topic = Topic.find(params[:id]) | |
end | |
def new |
This file contains 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 User | |
def buy_weapon(weapon_type) | |
User.transaction do | |
weapon = Weapon.create(weapon_type: weapon_type) | |
self.decrement!(:money, weapon_type.cost) | |
Log.create(message: "User #{id} bought a #{weapon_type.name} for #{weapon_type.cost}.") | |
end | |
end | |
end |
This file contains 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 UsersController < ApplicationController | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) | |
@user.persistence_token = User.generate_persistence_token | |
@user.location = Location.find_available_location |
This file contains 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 UsersController < ApplicationController | |
rescue_from Location::NotAround, with: :handle_not_around_errors | |
def new | |
@user = User.new | |
end | |