active_fedora icon indicating copy to clipboard operation
active_fedora copied to clipboard

Using ActiveFedora::ChangeSet with MetadataNode

Open awead opened this issue 10 years ago • 0 comments

When trying to using MetadataNode to write values to the fcr:metadata resource, ChangeSet throws an error.

> obj.thumbnail.metadata.set_value(ActiveFedora::RDF::Fcrepo4.created, Date.today)
=> nil
> obj.thumbnail.metadata.get_values(ActiveFedora::RDF::Fcrepo4.created)
=> [Fri, 16 Jan 2015]
> obj.thumbnail.metadata.save
NoMethodError: undefined method `local_attributes' for #<ActiveFedora::WithMetadata::MetadataNode:0x007fb26a21cc98>
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/rdf-1.1.7/lib/rdf/mixin/enumerable.rb:693:in `method_missing'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/rdf-1.1.7/lib/rdf/mixin/mutable.rb:175:in `method_missing'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/activemodel-4.1.7/lib/active_model/attribute_methods.rb:435:in `method_missing'
    from /Users/awead/Projects/Github/projecthydra/active_fedora/lib/active_fedora/change_set.rb:28:in `block in changes'
    from /Users/awead/Projects/Github/projecthydra/active_fedora/lib/active_fedora/change_set.rb:21:in `each'
    from /Users/awead/Projects/Github/projecthydra/active_fedora/lib/active_fedora/change_set.rb:21:in `each_with_object'
    from /Users/awead/Projects/Github/projecthydra/active_fedora/lib/active_fedora/change_set.rb:21:in `changes'
    from /Users/awead/Projects/Github/projecthydra/active_fedora/lib/active_fedora/with_metadata/metadata_node.rb:41:in `save'
    from (irb):9
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:90:in `start'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:9:in `start'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:69:in `console'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands.rb:17:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

awead avatar Jan 16 '15 16:01 awead