Questions tagged [elixir]

Elixir is an open-source, dynamic, compiled, general purpose functional programming language. It was designed to be fully compatible with the Erlang platform and is well suited to writing fault-tolerant, distributed applications with soft real-time guarantees and the ability for hot-code-swapping.

enter image description here

Elixir is an open-source, dynamic, compiled, general purpose functional programming language. It was designed to be fully compatible with the Erlang platform and is well suited to writing fault-tolerant, distributed applications with soft real-time guarantees and the ability for hot-code-swapping.

Elixir was designed with programmer productivity as a core concept and features:

  • Concise friendly syntax
  • Simple meta-programming with Macros
  • Scale facility and process orientation
  • Awesome documentation and testing built-in
  • Polymorphism with Protocols

Learning

Packages

Popular Elixir Projects

Books

Screencasts

Community

9482 questions
5
votes
1 answer

what does endpoint.ex file do in phoenix elixir

I am new to elixir and phoenix, and using phoenix guides. In getting started guide they just say http://puu.sh/klblD/e50082298d.png but they didn't explain what is endpoint and whats is tasks. Can somebody explain whats it does?
Murtza
  • 1,386
  • 1
  • 19
  • 27
5
votes
2 answers

Using ecto to store custom information

I am re-implementing an application I originally wrote in Rails in Phoenix in which users can create custom fields using PostgreSQL's JSONB record type. As an example, we have the following (simplified representation) schema: Client ID (int) Client…
Mylan Connolly
  • 494
  • 1
  • 5
  • 15
5
votes
1 answer

What exactly is a Phoenix "Layout"?

In the Elixir IRC, josevalim refers to a way to compose templates in Phoenix, by defining and then using a layout helper, as such: <%= with_layout Layout, "app..." do %>hello<% end %> I'm very new to Phoenix, but I'm assuming the with_layout helper…
Eric S. Bullington
  • 1,001
  • 1
  • 11
  • 18
5
votes
2 answers

has_one without belongs_to in ecto/phoenix/elixir

Problem I have a files table and there are many other tables that create a one-to-one association, e.g. users might have a avatar and posts might have photo. A possible solution A possible solution would be to create users_files and posts_files…
Cristian Garcia
  • 9,630
  • 6
  • 54
  • 75
5
votes
2 answers

Socket won't connect to Endpoint

var socket = new Socket("localhost:4000") socket.connect() Returns WebSocket connection to 'ws://localhost:4000/ws' failed: Error during WebSocket handshake: Unexpected response code: 404 But I do have the socket on the /ws endpoint,…
iColor
  • 260
  • 2
  • 10
5
votes
1 answer

Phoenix EXRM release Websockets not working

I've tried to release my application with EXRM. The whole app is working except for WebSockets which fail to start This is the error in the browser (Chrome) WebSocket connection to 'ws://localhost:4001/socket/websocket?token=undefined' failed:…
Krzysztof Wende
  • 3,208
  • 25
  • 38
5
votes
1 answer

How to test an infinite, recursive Task in Elixir

Please check this code: defmodule InfinitePollTask do def poll(opts \\ []) # function body code here poll(new_opts) end end I want to write a unit test for the function body code, assuming the function body perform some important…
luishurtado
  • 133
  • 1
  • 5
5
votes
1 answer

How to specify multiple parameters in link

I have this in my router.ex: resources "/games", GamesController do get "/scores/:student_id", GameScoreController, :new post "/scores/:student_id", GameScoreController, :create end Now I am calling this with: link(student.name, to:…
5
votes
1 answer

Ecto - Updating nested (Polymorphic) Associations

How does one update a model with a nested association (using [Elixir, Phoenix, Ecto])? I've tried the following, to treat it as part of it's parent update, without success (using the platformatec blog as inspiration). Models: schema "user" do …
5
votes
1 answer

Import Phoenix Socket, Phoenix HTML JS Modules via Brunch when web server application is in an umbrella app

When a Phoenix web server is not in an umbrella app, Brunch finds the modules in "deps/phoenix/web/static/js/socket" and "deps/phoenix_html/web/static/js/phoenix_html" because the phoenix dependency gets installed into that location relative to the…
Havvy
  • 1,471
  • 14
  • 27
5
votes
1 answer

How to render raw html in Phoenix framework

I am trying to render raw html like this -> <%= raw " \n\n\n" %> but when I use Edit as Html in Chrome to get the code I see the following ->
NoDisplayName
  • 15,246
  • 12
  • 62
  • 98
5
votes
1 answer

How do I configure plug to set another directory as public other than priv/static/?

I'm currently using aurelia as my front end framework for my phoenix app. I would like to designate the jspm_packages folder in the root of my project as a static directory in addition to the priv/static folder. Is there a way to configure plug to…
Korbin
  • 1,788
  • 2
  • 18
  • 29
5
votes
3 answers

How to add a custom error message for a required field in Phoenix framework

How can I change the error message for required fields? If I have something like that @required_fields ~w(name email) and I want to show "no way it's empty" instead of the default value of "can't be blank" ?
NoDisplayName
  • 15,246
  • 12
  • 62
  • 98
5
votes
2 answers

How to validate presence in Phoenix framework?

Ecto can validate format, inclusion, uniqueness and so on, but I can't see how I can validate presence? is there a method to add an error to a field if it's empty? Like validates_presence_of in RoR ? I can make it manually, it's not a problem, but I…
NoDisplayName
  • 15,246
  • 12
  • 62
  • 98
5
votes
2 answers

How to kill Elixir Daemon

I start daemon of elixir. elixir --detached -S mix run But I cannot find way to kill this. (My Server is CentOS.)
taku_oka
  • 453
  • 6
  • 18