def update
- if valid_feed_name?(params[:new_feed_name])
- item = FeedItem.find_by_feed_name_and_title(params[:new_feed_name], params[:title])
+ if valid_feed_name?(params[:feed_name])
+ item = FeedItem.find_by_feed_name_and_title(params[:feed_name], params[:title])
if item
if params[:description] == ''
destroy_item(item)
def create_item
- item = FeedItem.new(:feed_name => params[:new_feed_name],
+ item = FeedItem.new(:feed_name => params[:feed_name],
:title => params[:title],
:description => params[:description])
item.save!
flash[:notice] = "Element #{params[:title]} created"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :ok }
end
rescue ActiveRecord::RecordInvalid => error
flash[:notice] = "Element #{params[:title]} could not be created"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :unprocessable_entity }
end
end
if item.update_attribute(:description, params[:description])
flash[:notice] = "Element #{params[:title]} updated"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :ok }
end
else
flash[:notice] = "Element #{params[:title]} could not be updated"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :unprocessable_entity }
end
end
if item.destroy
flash[:notice] = "Element #{params[:title]} destroyed"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :ok }
end
else
flash[:notice] = "Element #{params[:title]} could not be destroyed"
respond_to do |format|
- format.html { redirect_to feed_url(params[:new_feed_name]) }
+ format.html { redirect_to feed_url(params[:feed_name]) }
format.rss { head :unprocessable_entity }
end
end