Skip to content

Commit

Permalink
Removes unneeded ApiTemplate.create in favor of ApiTemplate.new
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt committed Mar 29, 2012
1 parent 298742e commit b05ce9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions lib/acts_as_api/api_template.rb
Expand Up @@ -11,18 +11,11 @@ class ApiTemplate < Hash

# The name of the api template as a Symbol.
attr_accessor :api_template

attr_reader :options

# Returns a new ApiTemplate with the api template name
# set to the passed template.
def self.create(template)
t = ApiTemplate.new
t.api_template = template
return t
end
attr_reader :options

def initialize
def initialize(api_template = nil)
self.api_template = api_template
@options ||= {}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_api/base.rb
Expand Up @@ -34,7 +34,7 @@ def acts_as_api?#:nodoc:
# be contained in the api responses.
def api_accessible(api_template, options = {}, &block)

attributes = api_accessible_attributes(api_template) || ApiTemplate.create(api_template)
attributes = api_accessible_attributes(api_template) || ApiTemplate.new(api_template)

attributes.merge!(api_accessible_attributes(options[:extend])) if options[:extend]

Expand Down

0 comments on commit b05ce9d

Please sign in to comment.