My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 96 attachment: dont_crash_with_invalid_tag_v2.patch (1.2 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Index: /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/controllers/store_controller.rb
===================================================================
--- /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/controllers/store_controller.rb (revision 78)
+++ /home/edmundo/workspace_aptana/trunk/vendor/plugins/substruct/app/controllers/store_controller.rb (working copy)
@@ -74,6 +74,10 @@
# Passed into this controller like this:
# /store/show_by_tags/tag_one/tag_two/tag_three/...
@tag_names = params[:tags]
+ if @tag_names.empty?
+ flash[:notice] = "Sorry, you didn't specified a tag."
+ redirect_to :action => 'index' and return false
+ end
# Generate tag ID list from names
tag_ids_array = Array.new
for name in @tag_names
@@ -80,7 +84,10 @@
temp_tag = Tag.find_by_name(name)
if temp_tag then
tag_ids_array << temp_tag.id
- end
+ else
+ flash[:notice] = "Sorry, we couldn't find the tag #{name} you were looking for."
+ redirect_to :action => 'index' and return false
+ end
end
@viewing_tags = Tag.find(tag_ids_array)
viewing_tag_names = @viewing_tags.collect { |t| " > #{t.name}"}

Powered by Google Project Hosting