I hereby claim:
- I am mitchellhenke on github.
- I am mitchellhenke (https://keybase.io/mitchellhenke) on keybase.
- I have a public key whose fingerprint is AF0E D07A EBCF 1C10 E322 1D22 E8B4 95EE B979 509F
To claim this, I am signing this object:
after_connect = proc do |connection| | |
connection.query("UPDATE items set text='testing' where id = 34;") | |
end | |
Sequel::Model.db = Sequel.connect(ENV['DATABASE_URL'], after_connect: after_connect) |
defmodule User do | |
use Ecto.Model | |
schema "users" do | |
field :username, :string | |
end | |
end |
defmodule Repo.Migrations.UserSearch do | |
use Ecto.Migration | |
def up do | |
execute "CREATE extension if not exists pg_trgm;" | |
execute "CREATE INDEX users_username_trgm_index ON users USING gin (username gin_trgm_ops);" | |
end | |
def down do | |
execute "DROP INDEX users_username_trgm_index;" |
defmodule User do | |
use Ecto.Model | |
schema "users" do | |
field :username, :string | |
end | |
def search(query, search_term) do | |
from(u in query, | |
where: fragment("? % ?", u.username, ^search_term), |
User |> User.search("mitch") |> Repo.all | |
# [debug] SELECT u0."id", u0."username" FROM "users" AS u0 WHERE (u0."name" % $1) ORDER BY similarity(u0."name", $2) DESC ["mitch", "mitch"] (1.9ms) | |
[%User{__meta__: %Ecto.Schema.Metadata{source: "users", state: :loaded}, | |
username: "mitch"}, | |
%User{__meta__: %Ecto.Schema.Metadata{source: "users", state: :loaded}, | |
username: "mitch3"}] |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Padrino Admin</title> | |
<%= stylesheet_link_tag :base, "themes/default/style" %> | |
</head> | |
<body> | |
<div id="container"> | |
<div id="box"> |
module Review | |
module Account | |
class ReviewImagesController < ApplicationController | |
def create | |
puts params | |
render :json => {:stuff=>params}.to_json | |
end | |
end |
defmodule App.Mixfile do | |
use Mix.Project | |
def project do | |
[app: :app, | |
version: "0.0.1", | |
elixir: "~> 1.2", | |
elixirc_paths: elixirc_paths(Mix.env), | |
compilers: [:phoenix] ++ Mix.compilers, | |
build_embedded: Mix.env == :prod, |
1) test node_name/1 returns the node name (Phoenix.PubSubTest) | |
deps/phoenix_pubsub/test/shared/pubsub_test.exs:68 | |
** (MatchError) no match of right hand side value: [] | |
stacktrace: | |
lib/phoenix/pubsub.ex:287: Phoenix.PubSub.call/3 | |
deps/phoenix_pubsub/test/shared/pubsub_test.exs:69: (test) | |
Finished in 0.3 seconds |
I hereby claim:
To claim this, I am signing this object: