Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes for API

  • Loading branch information...
commit 5c47d5ed9bc00e1f9dbeab94d01d7a809049a708 1 parent 59de51b
@mattyoho mattyoho authored
View
8 app/controllers/api/feed_items_controller.rb
@@ -26,7 +26,7 @@ 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
@@ -34,8 +34,8 @@ def create
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
View
2  app/views/api/feeds/show.json.jbuilder
@@ -25,4 +25,4 @@ json.items do |json|
end
end
-json.web_url url_for(@feed)
+json.web_url feed_url(@feed)
Please sign in to comment.
Something went wrong with that request. Please try again.