Skip to content

Instantly share code, notes, and snippets.

@k-rudy
Last active August 29, 2018 08:27
Show Gist options
  • Save k-rudy/161f378c2f2d43e72bee59910e7003ff to your computer and use it in GitHub Desktop.
Save k-rudy/161f378c2f2d43e72bee59910e7003ff to your computer and use it in GitHub Desktop.
attributes
Attributes::Extract.(params, schema: schema)
{
attributes: {
first_name: 'Kon',
last_name: 'Rudy'
},
custom_fields: [
{
name: 'skills'
values: ['Ruby on Rails', 'Ruby']
}
],
positions: [
{
attributes: {
start_date: '1985-01-02',
current: true,
},
custom_fields: [
{
name: 'company'
values: ['ProFinda']
}
]
}
]
}
{
first_name: 'Kon',
last_name: 'Rudy',
skills: ['Ruby on Rails', 'Ruby'],
positions: [
{
start_date: '1985-01-02',
current: true,
company: 'ProFinda'
}
]
}
{
first_name: 'Kon',
last_name: 'Rudy',
skills: [
{
value: 'Ruby on Rails',
global_id: 'ecco_123'
},
{
value: 'Ruby',
weight: 3.0
}
],
location: {
value: 'London, England, United Kingdom',
extra: {
state: 'England',
name: 'London',
country: 'United Kingdom',
lat: 30.02,
lon: 123.23
}
},
main_position: {
company: 'ProFinda',
start_date: '2001-01-01',
title: 'CEO'
},
positions: [
{
start_date: '1985-01-02',
current: true,
company: 'ProFinda',
title: 'CTO'
}
]
}
class Profile::Update < Trailblazer::Operation
step :validate_schema
step :extract_attributes
step :update_profile
# it will go once CustomFields are migrated to Profile
step :assign_custom_fields
step :update_positions
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment