Permalink
Browse files

Fixes for API

  • Loading branch information...
mattyoho committed May 18, 2012
1 parent 59de51b commit 5c47d5ed9bc00e1f9dbeab94d01d7a809049a708
Showing with 5 additions and 5 deletions.
  1. +4 −4 app/controllers/api/feed_items_controller.rb
  2. +1 −1 app/views/api/feeds/show.json.jbuilder
@@ -26,16 +26,16 @@ def create
respond_to do |format|
if @feed_item.save
- format.json { render status: :created, location: api_feed_feed_item_url(feed, @feed_item) }
+ format.json { render status: :created, location: api_feed_feed_item_url(current_user.feed, @feed_item) }
else
format.json { render status: :unprocessable_entity }
end
end
end
def update
- kind = params[:item].delete(:type)
- @feed_item = current_user.feed.feed_item_of(kind).new(params[:item])
+ @feed_item = current_user.feed.feed_items.find(params[:id])
+ @feed_item.attributes = params[:item]
respond_to do |format|
if @feed_item.save
@@ -49,7 +49,7 @@ def update
private
def verify_feed_ownership
- unless current_user.feed.display_name == params[:feed_id]
+ unless current_user.feed.name == params[:feed_id]
head status: :unauthorized
end
end
@@ -25,4 +25,4 @@ json.items do |json|
end
end
-json.web_url url_for(@feed)
+json.web_url feed_url(@feed)

0 comments on commit 5c47d5e

Please sign in to comment.