8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/bullet_train/supercharts/scaffolders/chart_scaffolder.rb', line 8
def run
unless argv.count >= 2
puts ""
puts "🚅 usage: bin/super-scaffold supercharts:chart <TargetModel> <ParentModel[s]>"
puts ""
puts "E.g. a chart on the team dashboard showing click-throughs per day"
puts "This is assuming that you've already got a ClickThrough model, capturing each campaign click-through as a separate record. The chart will default to group by day derived by the :created_at"
puts ""
puts " bin/super-scaffold supercharts:chart ClickThrough Team"
puts ""
standard_protip
puts ""
exit
end
target_model, parent_models = argv
parent_models = parent_models.split(",")
parent_models += ["Team"]
parent_models = parent_models.map(&:classify).uniq
transformer = Scaffolding::SuperchartsChartTransformer.new(target_model, parent_models)
transformer.scaffold_supercharts
end
|