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
require 'open-uri' | |
require 'csv' | |
class Import < ActiveRecord::Base | |
attr_reader :account | |
attr_reader :file | |
has_one :import_file, class_name: 'Attachment::ImportFile', as: :attachable | |
belongs_to :importable, polymorphic: true | |
accepts_nested_attributes_for :import_file |
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
class Accounts::ImportsController < Accounts::BaseController | |
before_filter :load_import, only: [:show, :update, :perform] | |
respond_to :html, :json | |
layout false | |
expose(:upload_members_form) | |
def create | |
import = Import.create(import_params) |
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
class ToolPresenter < SimpleDelegator | |
require 'rubygems' | |
require 'action_view' | |
include ActionView::Helpers::DateHelper | |
def initialize(posts) | |
@posts = posts | |
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
A. Annotate the Code Above with an explanation of what's being done | |
One liner answer: | |
Its finding the missions with eager loading the milestones, company etc after applying the filters depending upon what filters(search/mission type id) has been passed to it. | |
B. List the params being acted upon | |
1. mission_type_id | |
2. search | |
C. List the variables being exposed for the view and what you expect they'll contain |
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
class ToolDecorator < Draper::Decorator | |
include Trials::RatingToGrade | |
delegate_all | |
def grade | |
rating_to_grade(model.rating) | |
end | |
def trial_grade |