<repo_name>ashtoncoghlan/iym_final<file_sep>/db/migrate/20160113172345_change_format_of_semesters.rb
class ChangeFormatOfSemesters < ActiveRecord::Migration
  def change
    remove_column :semesters, :marking_period
  end
end
<file_sep>/todo.txt
Admissions officer membership application
- []Form: application
- Page: Thanks for requesting to sign up! We’ll get back to you in 2-3 business days. In the meantime, checkout…
- Membership application email - Have you forgotten about us? Please finish your application.
- Membership application email - thanks for requesting to sign up
- Membership application email - we’d like more information, can we speak on the phone or - Skype?
- Membership application email - you’ve been accepted!
- Membership application email - Sorry, you did not get accepted. If you think this is a mistake, please contact us…

Prospective student membership application
- Form: application
- Page: Thanks for requesting to sign up! We’ll get back to you in 2-3 business days. In the meantime, checkout…
- Membership application email - Have you forgotten about us? Please finish your application.
- Membership application email - thanks for requesting to sign up
- Membership application email - we’d like more information, can we speak on the phone or - Skype?
- Membership application email - you’ve been accepted!
- Membership application email - Sorry, you did not get accepted. If you think this is a mistake, please contact us…


studentList
- mouseOver options like Pinterest (JQuery)<file_sep>/config/routes.rb
Rails.application.routes.draw do
  resources :semesters
  resources :comments
  resources :sports
  resources :students
  resources :charts, only: [:show]
  get 'charts/show'

  get 'home/index'


  devise_for :users
  root to: "home#index"
end
<file_sep>/db/migrate/20160111185116_drop_grades_table.rb
class DropGradesTable < ActiveRecord::Migration
  def change
    drop_table :grades
  end
end
<file_sep>/db/migrate/20160111191611_add_columns_to_semester.rb
class AddColumnsToSemester < ActiveRecord::Migration
  def change
    add_column :semesters, :math, :integer
    add_column :semesters, :science, :integer
    add_column :semesters, :english, :integer
    add_column :semesters, :social_studies, :integer
    remove_column :semesters, :title
    remove_column :semesters, :transcript_id
  end
end
<file_sep>/spec/factories/semesters.rb
FactoryGirl.define do
  factory :semester do
    title "MyString"
transcript nil
  end

end
<file_sep>/spec/factories/transcripts.rb
FactoryGirl.define do
  factory :transcript do
    school "MyString"
image "MyString"
student nil
  end

end
<file_sep>/spec/factories/courses.rb
FactoryGirl.define do
  factory :course do
    name "MyString"
grade "MyString"
semester nil
  end

end
<file_sep>/app/views/students/index.json.jbuilder
json.array!(@students) do |student|
  json.extract! student, :id, :last_name, :first_name, :description, :gender, :dob, :current_school, :current_grade, :interests, :picture, :user_id
  json.url student_url(student, format: :json)
end
<file_sep>/app/views/sports/index.json.jbuilder
json.array!(@sports) do |sport|
  json.extract! sport, :id, :name, :years_played, :positions, :awards, :student_id
  json.url sport_url(sport, format: :json)
end
<file_sep>/app/models/student.rb
class Student < ActiveRecord::Base
  mount_uploader :picture, PictureUploader

  belongs_to :user
  has_many :comments

  has_many :sports, dependent: :destroy
  accepts_nested_attributes_for :sports, allow_destroy: true

  has_many :addresses, dependent: :destroy
  accepts_nested_attributes_for :addresses, allow_destroy: true

  has_many :semesters, dependent: :destroy
  accepts_nested_attributes_for :semesters, allow_destroy: true

  validates :first_name, presence: true
  validates :last_name, presence: true

  def to_s
    first_name + " " + last_name
  end
end
<file_sep>/app/controllers/concerns/charts_controller.rb
class ChartsController < ApplicationController

  def show
  end

  private
    def student_params
      params.require(:student).permit(:name, :student_id)
    end

end<file_sep>/app/controllers/students_controller.rb
class StudentsController < ApplicationController
  before_action :set_student, only: [:show, :edit, :update, :destroy]

  def index
    @students = Student.all
  end

  def show
    @comments = @student.comments.all
    @comment = @student.comments.build
    @semester = @student.semesters.build
  end

  def new
    @student = Student.new
    @student.sports.build
    @student.addresses.build
    @student.transcripts.build
    @student.semesters.build
  end

  def edit
    @student.sports.build
    @student.addresses.build
    @student.transcripts.build
    @student.semesters.build
  end

  def create
    @student = Student.new(student_params)

    respond_to do |format|
      if @student.save
        format.html { redirect_to @student, notice: 'Student was successfully created.' }
        format.json { render :show, status: :created, location: @student }
      else
        format.html { render :new }
        format.json { render json: @student.errors, status: :unprocessable_entity }
      end
    end
  end

  def update
    respond_to do |format|
      if @student.update(student_params)
        format.html { redirect_to @student, notice: 'Student was successfully updated.' }
        format.json { render :show, status: :ok, location: @student }
      else
        format.html { render :edit }
        format.json { render json: @student.errors, status: :unprocessable_entity }
      end
    end
  end

  def destroy
    @student.destroy
    respond_to do |format|
      format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    def set_student
      @student = Student.find(params[:id])
    end

    def student_params
      params.require(:student).permit(:picture,
                                      :last_name,
                                      :first_name,
                                      :description,
                                      :gender,
                                      :dob,
                                      :current_school,
                                      :current_grade,
                                      :interests,
                                      :user_id,
                                      sports_attributes: [:id, :name, :years_played, :positions, :awards, :_destroy],
                                      addresses_attributes: [:id, :street, :city, :state, :zipcode, :student_id],
                                      transcripts_attributes: [:id, :school, :student_id, :picture],
                                      semesters_attributes: [:id, :marking_period, :year, :student_id, :math, :science, :english, :social_studies])
    end


end
<file_sep>/spec/features/smoke_spec.rb
require "rails_helper"

RSpec.feature "User views homepage" do
  scenario "it sees Welcome" do
    visit root_path
    expect(page).to have_text("Inspiring")
  end

end


<file_sep>/app/controllers/semesters_controller.rb
class SemestersController < ApplicationController

  def index
    @semesters = Semester.all
  end

end<file_sep>/spec/factories/addresses.rb
FactoryGirl.define do
  factory :address do
    street "MyString"
city "MyString"
state "MyString"
zipcode 1
student nil
  end

end
<file_sep>/app/controllers/sports_controller.rb
class SportsController < ApplicationController

  def index
    @sports = Sport.all
  end

end<file_sep>/app/views/semesters/index.json.jbuilder
json.array!(@semesters) do |semester|
  json.extract! semester, :id, :student_id, :marking_period, :year, :math, :science, :english, :social_studies
  json.url semester_url(semester, format: :json)
end
<file_sep>/spec/factories/charts.rb
FactoryGirl.define do
  factory :chart do
    name "MyString"
    student 1
  end

end
