Skip to content

Instantly share code, notes, and snippets.

View thiagovsk's full-sized avatar
🏠
Working from home

Thiago Ribeiro thiagovsk

🏠
Working from home
View GitHub Profile
<script type="text/javascript">
$(function() {
function cutAndPaste(from, to) {
$(to).append(function() {
return $(from + " option:selected").each(function() {
this.outerHTML;
}).remove();
# -*- encoding : utf-8 -*-
class TypesController < ApplicationController
# GET /types
# GET /types.json
def index
@types = Type.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @types }
# -*- encoding : utf-8 -*-
class PlacesController < ApplicationController
# GET /places
# GET /places.json
def index
@places = Place.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @places }
<script type="text/javascript">
$(function() {
function cutAndPaste(from, to) {
$(to).append(function() {
return $(from + " option:selected").each(function() {
this.outerHTML;
}).remove();
<div class="page-header">
<%= simple_form_for(@atendimento, :html => {:class => 'form-horizontal' }) do |f| %>
</div>
<dirv class="page-header">
<%= simple_form_for(@atendimento, :html => {:class => 'form-horizontal' }) do |f| %>
<div class="actions">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
require "cancan/matchers"
require 'spec_helper'
describe "User" do
describe "Ability" do
subject(:ability){ Ability.new(user) }
let(:user){ nil }
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :user do |f|
f.name "Alessandro"
f.username "alessandrocb"
f.matricula "123456789"
f.password "123456789"
f.password_confirmation "123456789"
f.after(:create) {|user| user.add_role(:student)}
class CreateConvenios < ActiveRecord::Migration
def change
create_table :convenios do |t|
t.string :numeroconvenio
t.string :uf
t.string :codigosiafi
t.string :nomemunicipio
t.string :situacaoconvenio
t.string :numerooriginal
t.string :objetoconvenio
private
# Use callbacks to share common setup or constraints between actions.
def set_convenio
@convenio = Convenio.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def convenio_params
params.require(:convenio).permit(:numeroconvenio, :uf, :codigosiafi, :nomemunicipio, :situacaoconvenio, :numerooriginal, :objetoconvenio, :codigoorgaosuperior, :nomeorgaosuperior, :codigoconcedente, :nomeconcedente, :codigoconvenente, :nomeconvenente, :tipoenteconvenente, :valorconvenio, :valorliberado, :datapublicacao, :datainiciovigencia, :datafimvigencia, :valorcontrapartida, :dataultimaliberacao, :valorultimaliberacao)