Skip to content

Instantly share code, notes, and snippets.

@donpdonp
donpdonp / fist
Created January 31, 2013 22:11 — forked from wraithan/fist
_ ,-, _
,--, /: :\/': :`\/: :\
|`; ' `,' `.; `: |
| N | E | R | D |.
| :L | I | F | E ||
| :. | : | . | : | \
\__/: :.. : :.. | :.. | )
`---',\___/,\___/ /'
`==._ .. . /'
`-::-'
class Diaria < ActiveRecord::Base
has_many :itens, :class_name => "DiariaItem"
def gerarItensDiaria
itens.create({:tipo => 3,
:quantidade => diaria_com_pernoite,
:valor => 150.00})
end
end
create_table "permits", :force => true do |t|
t.string "number", :null => false
t.string "name", :null => false
t.string "agency_project"
t.integer "contact_id"
t.string "category"
t.string "when_req"
t.string "owner"
t.string "renewable"
t.boolean "startup_monitoring_reqd"
Common minimal format for sending just lat/long data
[
{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z",
location: {
position: {
geojson: { "type": "Point",
"coordinates": [11.0, 61.0] }
}
@donpdonp
donpdonp / gist:186896
Created September 14, 2009 20:07 — forked from Hates/gist:186893
module States
STATES = %w(cancelled declined passive active approved pending flagged complete)
attr_accessor :state # remove this if using an activerecord column
def self.included(mod)
STATES.each do |state|
up_state = state.upcase
mod.const_set(up_state, state)
mod.send(:define_method, state+'?') do