Skip to content

Commit

Permalink
Minor change in reference model to store a reference parsed by parscit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Wenneker committed May 4, 2010
1 parent 45b2f38 commit 081df44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions app/controllers/parscit_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ def show
@parscit_record_yaml = hash.to_yaml
# Convert it to a Bibmix::Record so that it can be merged with data
# from bibsonomy.

puts @parscit_record_yaml

#puts hash.to_yaml
record = Bibmix::Record.from_hash(hash)


Expand Down
7 changes: 5 additions & 2 deletions app/models/reference.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require "iconv"
require "tempfile"

class Reference < ActiveRecord::Base
def self.create_with_parscit(str)
if str.nil? || str.eql?("")
Expand Down Expand Up @@ -39,22 +42,22 @@ def self.create_with_parscit(str)
citation.delete k
}

citation['author'] = citation['authors']['author']
citation['citation'] = str
citation['parser'] = 'parscit'
self.create(citation)
end

def to_hash

block = ['id', 'created_at', 'updated_at', 'author', 'authors', 'parser']
block = ['id', 'created_at', 'updated_at', 'authors', 'parser']
hash = self.attributes.inject({}) do |result, element|
if !block.include?(element.first)
result[element.first] = element.last
end
result
end

hash['author'] = self.authors['author']
hash
end
end

0 comments on commit 081df44

Please sign in to comment.