close
Skip to main content

New answers tagged

Score of 0

Form validation in ruby on rails

If you submit the form via JavaScript as a JSON request, you can keep the HTML exactly as it is. You also don't need a custom validate_signup method. Rails handles validation when you try to save a ...
Score of 1

How to make a guest connection in Action Cable?

Action Cable doesn't require a current user for each connection. There are two common options for guest connections: Public connection - simply allow WebSocket connections without authentication. ...
Score of 3

How to make sentence DSL in Ruby?

The idea of an Internal DSL is that it is just a clever way of using the host language's syntax. In other words, code written in an Internal DSL is syntactically valid host language code. However, the ...
Score of -1

Automatically set instance variable as method argument?

method(:initialize).parameters.map { |_, arg| eval("@#{arg} = #{arg}", binding, __FILE__, __LINE__) }
Score of 0

undefined local variable or method `http' for main:Object (NameError)

For me running: ruby -run -e httpd . -p 8000 works well with ruby 2.2 but with 1.8.7 -e:1: undefined local variable or method httpd' for main:Object (NameError) So guess you gotta go the manual route ...

Top 50 recent answers are included