Skip to content

Instantly share code, notes, and snippets.

@diabolo
Forked from krisleech/01-domain_trip.rb
Created November 16, 2012 14:00
Show Gist options
  • Save diabolo/4087570 to your computer and use it in GitHub Desktop.
Save diabolo/4087570 to your computer and use it in GitHub Desktop.
domain and persistence
class Domain::Trip
include Virtus
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attribute :id
attribute :name
attribute :sections, Array[Section], :default => []
def find(params)
PersistenceTrip.(whatever criteria you need using params to get id, etc)
end
end
class Persistence::Trip < ActiveRecord::Base
end
def show
@trip = Trip.find(params[:id)
end
- @trip.sections.each do |section|
= section.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment