From 41168f4c99a9209b19b2810318340c364b972c8b Mon Sep 17 00:00:00 2001 From: "Matt K. Fu" Date: Tue, 23 Apr 2013 10:01:02 +0800 Subject: [PATCH] fix for fronted routing failed --- Gemfile.lock | 5 +++++ app/models/item.rb | 2 +- lib/parsers/parser_front_end.rb | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e8f070d7..05696d95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -194,6 +194,10 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) + rack-gridfs (0.4.1) + mime-types + mongo (~> 1.2) + rack rack-oauth2 (1.0.0) activesupport (>= 2.3) attr_required (>= 0.0.5) @@ -373,6 +377,7 @@ DEPENDENCIES pry-debugger pry-remote pry-stack_explorer + rack-gridfs radius rails (~> 3.2.9) rake diff --git a/app/models/item.rb b/app/models/item.rb index a149358f..fe569141 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -17,7 +17,7 @@ class Item validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ # validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } - validates_uniqueness_of :name, :scope => :parent_id + validates_uniqueness_of :name #, :scope => :parent_id validates_presence_of :name validates_associated :parent, :children diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 43c70b0d..1ad15540 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -30,8 +30,8 @@ module ParserFrontEnd part = PagePart.find(front['part_id']) if front['part_id'] ret << eval("\"#{front['path']}\"") rescue '' - args.each do |arg,index| - ret << (ret.include?("?") ? "&#{index}=arg": "?#{index}=arg" ) + args.each do |index,arg| + ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" ) end if args fragment = Nokogiri::HTML::DocumentFragment.new(body, "
") end