-
-
Save diabolo/4087570 to your computer and use it in GitHub Desktop.
domain and persistence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Persistence::Trip < ActiveRecord::Base | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
@trip = Trip.find(params[:id) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- @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