Sha256: 80e6c0406fff00144c75538fdc2e4d36020eae662bb446651626bae15ac22f9f

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

require 'yaml' # Built in, no gem required
require_dependency "familiarity/application_controller"

module Familiarity
  class FamiliaritiesController < ApplicationController
    before_filter :load_familiarities_yml

    def index
    end

    def save
      File.open(@file_path, 'w+') { |f| f.write (@familiarities_hash.merge(params[:from_page] => params[:familiarity_hash])).to_yaml } #Store
      render nothing: true, status: 200
    end

    private
    def load_familiarities_yml
      @file_path = File.join(Rails.root, 'familiarities.yml')
      @familiarities_hash = ((YAML::load_file(@file_path) rescue nil)|| {})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
familiarity-0.2.5 app/controllers/familiarity/familiarities_controller.rb
familiarity-0.2.4 app/controllers/familiarity/familiarities_controller.rb
familiarity-0.2.2 app/controllers/familiarity/familiarities_controller.rb
familiarity-0.2.1 app/controllers/familiarity/familiarities_controller.rb