Skip to content

Instantly share code, notes, and snippets.

Emanoel Lopes emanoelopes

Block or report user

Report or block emanoelopes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emanoelopes
emanoelopes / messages.rb
Last active Sep 25, 2017
CRUD de messagens para a API do SOLAR
View messages.rb
module V1
class Messages < Base
guard_all!
namespace :message do
helpers do
# return a @message object
def verify_user_permission_and_set_obj(permission) # permission = [:index, :create, ...]
@emanoelopes
emanoelopes / cliente.rb
Created Oct 25, 2016
Fancybox template missing
View cliente.rb
def new
@cliente = Cliente.new
render layout: 'fancybox'
end
@emanoelopes
emanoelopes / unicorn_votaprato
Created Oct 18, 2016
unicorn initialization script
View unicorn_votaprato
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn app server
# Description: starts unicorn using start-stop-daemon
View qualificacao.rb
class Qualificacao < ActiveRecord::Base
include Wisper::Publisher
after_create :publish_creation_successful
private
def publish_creation_successful
broadcast(:qualificacao_creation_successful, self)
end
View _form.html.erb
<% if @restaurante.errors.any? %>
<ul>
<% @restaurante.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
<%= form_for @restaurantes, html: {multipart: true} do |f| %>
Nome: <%= f.text_field :nome %> <br>
Endereço: <%= f.text_field :endereco %><br>
You can’t perform that action at this time.