Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
changed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
slowjack2k committed Jan 31, 2014
1 parent a236406 commit f634498
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ end

# You can convert them to poro's like this (automatic genereation of a poro class out of you'r AR class)

roles_converter = ActiverecordToPoro::Converter.new(Role)
salutation_converter = ActiverecordToPoro::Converter.new(Salutation)
user_converter = ActiverecordToPoro::Converter.new(User, convert_associations: {roles: roles_converter, salutation: salutation_converter})
roles_converter = ActiverecordToPoro::ObjectMapper.create(Role)
salutation_converter = ActiverecordToPoro::ObjectMapper.create(Salutation)
user_converter = ActiverecordToPoro::ObjectMapper.create(User, convert_associations: {roles: roles_converter, salutation: salutation_converter})


poro = user_converter.load(User.first)

# Or with you'r custom class

roles_converter = ActiverecordToPoro::Converter.new(Role,
load_source: YourPoroClass
)
roles_converter = ActiverecordToPoro::ObjectMapper.create(Role,
load_source: YourPoroClass
)


# default 1:1 mapping only or except

roles_converter = ActiverecordToPoro::Converter.new(Role,
roles_converter = ActiverecordToPoro::ObjectMapper.create(Role,
except: [:lock_version]
)

roles_converter = ActiverecordToPoro::Converter.new(Role,
roles_converter = ActiverecordToPoro::ObjectMapper.create(Role,
only: [:name]
)

Expand Down

0 comments on commit f634498

Please sign in to comment.