 
   def slugified_title(title) do
     title
-    |> String.downcase
+    |> String.downcase()
     |> String.replace(~r/[^A-Za-z0-9\s-]/, "")
     |> String.replace(~r/(\s|-)+/, "-")
   end


  def generate_slug do
    16
    |> :crypto.strong_rand_bytes
    |> :base64.encode
    |> String.replace(~r/[^A-Za-z0-9]/, "")
    |> String.slice(0, 10)
    |> String.downcase
  end

  def twitter_description(post) do


  @params ~w(title body developer_id channel_id likes max_likes)a
  def permitted_params, do: @params
  def required_params, do: @params

  schema "posts" do
    field(:title, :string)
    field(:body, :string)
    field(:slug, :string)
    field(:likes, :integer, default: 1)
    field(:max_likes, :integer, default: 1)
    field(:tweeted_at, :utc_datetime)

    belongs_to(:channel, Channel)
    belongs_to(:developer, Developer)

    timestamps()
  end
