Skip to content
Browse files

Should not have to add application to the version

  • Loading branch information...
1 parent fc47004 commit 1a6aacc5d73b295a4ac4497750464a4e583ea6d3 @baphled committed May 14, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/acceptable_model.rb
  2. +1 −1 spec/acceptable_model_spec.rb
View
3 lib/acceptable_model.rb
@@ -64,7 +64,7 @@ def representation attributes_block
#
def mime_type_lookup mime_type
respond_with = version_lookup mime_type
- mime_type.gsub('application/','').split('+').last unless respond_with.nil?
+ mime_type.split('+').last unless respond_with.nil?
end
#
@@ -85,6 +85,7 @@ def version_lookup mime_type
#
def strip_extra_header_info! mime_type
mime_type.slice! /(;[a-z0-9]+[a-z]+=?[a-z]*-?[0-9])+/
+ mime_type.gsub!('application/','')
end
class << self
View
2 spec/acceptable_model_spec.rb
@@ -10,7 +10,7 @@
AcceptableModel.define 'artist'
class AcceptableModel::Artist
- version ['application/json', 'application/xml', 'vnd.acme.artist-v1+json', 'vnd.acme.artist-v1+xml'] do |artist|
+ version ['json', 'xml', 'vnd.acme.artist-v1+json', 'vnd.acme.artist-v1+xml'] do |artist|
{ :id => artist.id, :name => artist.name }
end
end

0 comments on commit 1a6aacc

Please sign in to comment.
Something went wrong with that request. Please try again.