Skip to content

Instantly share code, notes, and snippets.

Avatar

Edward Loveall edwardloveall

View GitHub Profile
View action groups index.cr
class Groups::Index < BrowserAction
route do
groups = GroupQuery.new.join_users
render Groups::IndexPage, groups: groups
end
end
View keybase.md

Keybase proof

I hereby claim:

  • I am edwardloveall on github.
  • I am edwardloveall (https://keybase.io/edwardloveall) on keybase.
  • I have a public key ASBjhdBspYQMXOxIf1XZo_vcehWGHKY6GhcuTodDlQmFAgo

To claim this, I am signing this object:

@edwardloveall
edwardloveall / show.cr
Last active Jan 4, 2019
preload association
View show.cr
class Me::Show < BrowserAction
get "/me" do
follows = FollowQuery.new.preload_from.to_id(current_user.id)
render ShowPage, follows: follows
end
end
@edwardloveall
edwardloveall / example.cr
Last active Jan 1, 2019
follow form create! error
View example.cr
require "lucky_record"
class User < LuckyRecord::Model
table :users do
end
end
class UserQuery < User::BaseQuery
end
@edwardloveall
edwardloveall / create.cr
Last active Dec 31, 2018
Lucky Form error
View create.cr
class Follows::Create < BrowserAction
route do
existing_user = UserQuery.new.email(params.get(:email))
if existing_user
FollowForm.create!(from_id: current_user.id, to_id: existing_user.id)
flash.success = "Your invite has been sent to #{existing_user.email} for approval."
redirect to: Follow::New
end
end
end
View time-test.cr
class TimeThing
CONSTANT = 1.year.from_now
def method
1.year.from_now
end
end
while true
puts TimeThing::CONSTANT
View SketchSystems.spec
Model
new -> LocalOnly
LocalOnly*
save -> InFlight
Persisted
edit -> Edited
Edited
save -> InFlight
InFlight
success -> Persisted
View SketchSystems.spec
Record
new -> LocalOnly
LocalOnly*
save -> InFlight
Persisted
edit -> Edited
Edited
save -> InFlight
InFlight
success -> Persisted
You can’t perform that action at this time.