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 Admin < BaseModel | |
table do | |
column name : String | |
belongs_to user : User | |
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
# src/actions/rss/show.cr | |
#... | |
xml ArticlesXmlSerializer.new(articles, title: "Feed Name", description: "Here's the descr", path: request.path).render | |
#... | |
# src/actions/xml_action.cr | |
abstract class XMLAction < Lucky::Action | |
private def xml(body : String) | |
Lucky::TextResponse.new(context, content_type: "text/xml; charset=utf-8", body: body, status: 200) | |
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
defmodule MyApp.CommentView do | |
use MyApp.Web, :view | |
@attributes ~W(id name inserted_at) | |
def render("index.json", %{data: comments}) do | |
for comment <- comments, do: render("show.json", %{data: comment}) | |
end | |
def render("show.json", %{data: comment}) do | |
comment |
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
module Colleague::Classes | |
class CitizenshipStatus | |
include Processor | |
def process_field(value) | |
AlienStatus.find_code( value ) | |
end | |
end | |
end |