Skip to content

Instantly share code, notes, and snippets.

class ImportsController < ApplicationController
#...
def create
read_csv.each do |row|
attributes = row.to_h.map { |k, v| [attributes_map[k], v] }.to_h
attributes[:address] = "#{row['ulice']}, #{row['okres']}, #{row['misto']} #{row['psc']}"
attributes = attributes.reject { |k, v| k == nil }
Student.create_with(attributes).find_or_create_by(rodne_cislo: attributes[:rodne_cislo])
$(document).on 'turbolinks:load', ->
$('#export_from').datepicker('update', moment().format('DD-MM-Y'))
$('#export_until').datepicker('update', moment().format('DD-MM-Y'))
$('[data-behavior~=back_30_days]').on 'change', (e) ->
$('.back-in-time').hide('slow')
$("#{$(e.target).data('target')}").datepicker('update', moment().subtract(30, 'days').format('DD-MM-Y'))
class Person < ApplicationRecord
belongs_to :personable, polymorphic: true
end
class User < ApplicationRecord
has_one :person, as: :personable
end

Detailed Rubric

Subjective evaluation will be made on your work/process according to the following criteria:

1. Satisfactory Progress

  • 4: Developer completes iterations 1 through 6 as well as an additional supporting feature
  • 3: Developer completes iterations 1 through 6 (this includes one supporting feature) with few bugs and no missing functionality.
  • 2: Developer completes iterations 1 through 5 with some bugs or missing functionality.
  • 1: Developer fails to complete iterations 1 through 4, or there are significant issues with delivered functionality.