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
theory | |
OOP | |
ruby | |
inheritance | |
classes | |
modules | |
objects | |
private/public/protected | |
super |
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
SAINT DOCTRINE: | |
• TDD, start with integrations tests | |
• Use Service Objects for interaction between several models | |
• all texts to i18n (in multilingual projects) | |
• all bootstrap elements to own CSS classes (grids & utilities are exeptions) | |
• use BEM methodology for naming CSS classes | |
• no CSS in HTML | |
• no JavaScript in HTML | |
• no new gems/libraries without agreement |
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
User.all.each do |user| | |
user.attachments.each do |attachment| | |
unless ["contract", "terms_and_conditions", "consumer_credit_form", "consent_personal_data_processing", "registration_contract", "terms_and_conditions_provision", "loan_application", "terms_and_conditions_no_sign", "factura"].any? { |word| attachment.filename.include?(word) } | |
attachment.user_id = attachment.attachable_id | |
attachment.save | |
end | |
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
$(function() { | |
'use strict'; | |
var updateWidgetPreview = function() { | |
var iframe = $('#previewiframe'); | |
var form = $("#previewform"); | |
if (form.length == 0) { | |
form = $("<form/>", {id: "previewform", action: iframe.data('url'), target: "previewiframe", method: "GET"}); | |
form.hide(); | |
form.appendTo(document.body); |
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
# This file should contain all the record creation needed to seed the database with its default values. | |
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | |
# | |
# Examples: | |
# | |
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | |
# Mayor.create(name: 'Emanuel', city: cities.first) | |
users = User.create([{"email" => "user1@email.com", "password" => "12345678", "password_confirmation" => "12345678"}, {"email" => "user2@email.com", "password" => "12345678", "password_confirmation" => "12345678"}]) | |
DietaryPreference.create([{name: "I`ll eat it all!", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))}, |