View Gist Explanation
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
View sample_presenter
class ToolPresenter < SimpleDelegator
require 'rubygems'
require 'action_view'
include ActionView::Helpers::DateHelper
def initialize(posts)
@posts = posts
end
View sample_decorator
class ToolDecorator < Draper::Decorator
include Trials::RatingToGrade
delegate_all
def grade
rating_to_grade(model.rating)
end
def trial_grade
View sample_controller
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)
View sample_model
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