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
defmodule Rumbl.VideoChannel do | |
use Rumbl.Web, :channel | |
def join("videos:" <> video_id, _params, socket) do | |
{:ok, assign(socket, :video_id, String.to_integer(video_id))} | |
end | |
def handle_info(:ping, socket) do | |
count = socket.assigns[:count] || 1 | |
push socket, "ping", %{count: count} |
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
defmodule Rumbl.UserTest do | |
use Rumbl.ModelCase, async: true | |
alias Rumbl.User | |
@valid_attrs %{name: "A User", username: "eva", password: "secret"} | |
@invalid_attrs %{} | |
test "changeset with valid attributes" do | |
changeset = User.changeset(%User{}, @valid_attrs) | |
assert changeset.valid? |
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
{ | |
"erb": { | |
"extends": "html", | |
"snippets": { | |
"erb": "<%= %>" | |
} | |
} | |
} |
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
>> dig irc.quake.net | |
; <<>> DiG 9.8.3-P1 <<>> irc.quake.net | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 56425 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 | |
;; QUESTION SECTION: | |
;irc.quake.net. IN A |
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
========================================================================================================= | |
-> bookshelf git:(master) ✗ rake test | |
Run options: --seed 28100 | |
# Running: | |
F | |
Finished in 0.035472s, 28.1911 runs/s, 56.3822 assertions/s. | |
1) Failure: |
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
usersessionscontroller.rb | |
class UserSessionsController < ApplicationController | |
before_filter :require_no_user, :only => [:new, :create] | |
before_filter :require_user, :only => :destroy | |
def new | |
@user_session = UserSession.new | |
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 Comment < ActiveRecord::Base | |
belongs_to :commentable, :polymorphic => true | |
end | |
class Article < ActiveRecord::Base | |
has_many :comments, :as => :commentable | |
end | |
class Photo < ActiveRecord::Base | |
has_many :comments, :as => :commentable |
NewerOlder