Sha256: b55d122ff40719df8d8dbfad3261b18e2a66646595c0089192b1d68bb4822c0e

Contents?: true

Size: 511 Bytes

Versions: 29

Compression:

Stored size: 511 Bytes

Contents

def update_agent_type
  agent_types = YAML.load(open('db/fixtures/enju_biblio/agent_types.yml').read)
  agent_types.each do |line|
    l = line[1].select!{|k, v| %w(name display_name note).include?(k)}

    case l["name"]
    when "person"
      agent_type = AgentType.where(name: 'Person').first
      agent_type.update_attributes!(l) if agent_type
    when "corporate_body"
      agent_type = AgentType.where(name: 'CorporateBody').first
      agent_type.update_attributes!(l) if agent_type
    end
  end
end

Version data entries

29 entries across 28 versions & 2 rubygems

Version Path
enju_biblio-0.2.5 lib/tasks/agent_type.rb
enju_biblio-0.2.4 lib/tasks/agent_type.rb
enju_biblio-0.2.3 lib/tasks/agent_type.rb
enju_biblio-0.2.2 lib/tasks/agent_type.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.1/lib/tasks/agent_type.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.0/lib/tasks/agent_type.rb
enju_biblio-0.2.1 lib/tasks/agent_type.rb
enju_biblio-0.2.0 lib/tasks/agent_type.rb
enju_biblio-0.2.0.beta.4 lib/tasks/agent_type.rb
enju_biblio-0.2.0.beta.3 lib/tasks/agent_type.rb
enju_biblio-0.2.0.beta.2 lib/tasks/agent_type.rb
enju_biblio-0.2.0.beta.1 lib/tasks/agent_type.rb
enju_biblio-0.1.3 lib/tasks/agent_type.rb
enju_biblio-0.1.2 lib/tasks/agent_type.rb
enju_biblio-0.1.1 lib/tasks/agent_type.rb
enju_biblio-0.1.0 lib/tasks/agent_type.rb
enju_biblio-0.1.0.pre71 lib/tasks/agent_type.rb
enju_biblio-0.1.0.pre70 lib/tasks/agent_type.rb
enju_biblio-0.1.0.pre69 lib/tasks/agent_type.rb
enju_biblio-0.1.0.pre68 lib/tasks/agent_type.rb