Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bump to 0.4.0 - Full support of Rails 3.0 - Beta and RC no more suppo…

…rted
  • Loading branch information...
commit b0ffa902d3ba057135faf84bbbf6ee92fb1e33ba 1 parent 4ecdea4
@kwi kwi authored
View
4 CHANGELOG.rdoc
@@ -1,3 +1,7 @@
+0.4.0 (September 08, 2010)
+
+* Full support for Rails 3.0.0
+
0.3.8 (August 30, 2010)
* Support the first Rails3 official release (but nested resources is still broken)
View
2  README.rdoc
@@ -6,7 +6,7 @@ All necessary informations are available on the wiki: http://wiki.github.com/kwi
For any question, use the i18_routing google group: http://groups.google.com/group/i18n-routing
-Works with Rails 2.3 and Rails 3.0 ! (nested resources currently do not work on Rails3, will be fixed when Rails3 is released)
+Works with Rails 2.3 and Rails 3.0
=> Rails3 beta and RC versions are no longer supported !
== TODO for next releases (written the 9th of June)
View
2  i18n_routing.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "i18n_routing"
- s.version = "0.3.8"
+ s.version = "0.4.0"
s.author = "Guillaume Luccisano"
s.email = "guillaume.luccisano@gmail.com"
s.homepage = "http://github.com/kwi/i18n_routing"
View
16 lib/i18n_routing_rails3.rb
@@ -28,7 +28,7 @@ def localized_resources(type = :resources, *resources, &block)
options = res.extract_options!
r = res.first
- resource = type == :resource ? ActionDispatch::Routing::Mapper::SingletonResource.new(r, options.dup) : ActionDispatch::Routing::Mapper::Resource.new(r, options.dup)
+ resource = resource_from_params(type, r, options.dup)
# Check for translated resource
@locales.each do |locale|
@@ -41,6 +41,8 @@ def localized_resources(type = :resources, *resources, &block)
opts = options.dup
opts[:path] = localized_path
opts[:controller] ||= r.to_s.pluralize
+
+ resource = resource_from_params(type, r, opts.dup)
res = ["#{locale}_#{r}".to_sym, opts]
@@ -50,8 +52,8 @@ def localized_resources(type = :resources, *resources, &block)
scope(:constraints => constraints, :path_names => I18nRouting.path_names(resource.name, @scope)) do
localized_branch(locale) do
send(type, *res) do
+
# In the resource(s) block, we need to keep and restore some context :
-
if block
old_name = @scope[:i18n_real_resource_name]
old = @scope[:scope_level_resource]
@@ -106,7 +108,7 @@ def localizable_route
# Return the aproximate deep in scope level
def nested_deep
- (@scope and Array === @scope[:blocks] and @scope[:scope_level]) ? @scope[:blocks].size : 0
+ (@scope and Array === @scope[:nested_deep] and @scope[:scope_level]) ? @scope[:nested_deep].size : 0
end
public
@@ -204,14 +206,16 @@ def match(*args)
end
def create_globalized_resources(type, *resources, &block)
-
#puts "#{' ' * nested_deep}Call #{type} : #{resources.inspect} (#{@locales.inspect}) (#{@localized_branch}) (#{@skip_localization})"
+ @scope[:nested_deep] ||= []
+ @scope[:nested_deep] << 1
+
cur_scope = nil
if @locales
localized = localized_resources(type, *resources, &block) if !@skip_localization
- ## We do not translate if we are in a translations branch :
+ ## We do not translate if we are in a translation branch :
return if localized and nested_deep > 0
# Set the current standard resource in order to customize url helper :
@@ -227,6 +231,8 @@ def create_globalized_resources(type, *resources, &block)
send("#{type}_without_i18n_routing".to_sym, *resources, &block)
end
end
+
+ @scope[:nested_deep].pop
end
Please sign in to comment.
Something went wrong with that request. Please try again.