Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10145 (new defect)

Opened 10 months ago

Last modified 10 months ago

End is misplaced in environment.rb

Reported by: malagant Assigned to: core
Priority: high Milestone: 1.2.7
Component: Railties Version: edge
Severity: major Keywords:
Cc:

Description

When creating own Inflector pluralizations there is an error. I compared the generated environment.rb of rails 1.x and edge and found a misplaced "end" statement as follows. This prevents one from running your own pluralizations.

wrong code:

# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end

# See Rails::Configuration for more options

end

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile

# Include your application configuration below

correct code:

# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc

# See Rails::Configuration for more options

end

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile

# Include your application configuration below

Change History

11/12/07 14:59:23 changed by chuyeow

Hmm I suspect the problem here is that you generated the environment.rb file using Rails 1.2.x instead of Edge Rails.

On edge, inflectors actually go into the RAILS_ROOT/config/initializers directory (committed in r6212).

If you could format the example code you pasted it (surround them with '{ { {' and closing '} } }' tags, without the spaces) would help a lot in figuring out your problem.

11/12/07 15:59:55 changed by malagant

  • milestone changed from 2.0 to 1.2.6.

You're right.

But. In Rails 1.2.5 the bug is definitive there. The problem is, that people usually uncomment the inflector stuff and run into trouble.

So, sorry for the wrong version number. I will set it to Rails 1.2.5

# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc 

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end 

# See Rails::Configuration for more options 

end 

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile 

# Include your application configuration below 

should be (in 1.2.6):

# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc 


# See Rails::Configuration for more options 

end 

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end 

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile 

# Include your application configuration below 

Attachments
  
Change History
  11/12/07 14:59:23 changed by chuyeow  ΒΆ
Hmm I suspect the problem here is that you generated the environment.rb file using Rails 1.2.x instead of Edge Rails. 

On edge, inflectors actually go into the RAILS_ROOT/config/initializers directory (committed in r6212). 

If you could format the example code you pasted it (surround them with '{ { {' and closing '} } }' tags, without the spaces) would help a lot in figuring out your problem. 



--------------------------------------------------------------------------------

Add/Change #10145 (End is misplaced in environment.rb)
Comment (you may use WikiFormatting here):

You're right.

But. In Rails 1.2.5 the bug is definitive there.
The problem is, that people usually uncomment the inflector stuff and run into trouble.

So, sorry for the wrong version number. I will set it to Rails 1.2.5

{{{
# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc 

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end 

# See Rails::Configuration for more options 

end 

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile 

# Include your application configuration below 
}}}

should be (in 1.2.6):
{{{
# Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc 


# See Rails::Configuration for more options 

end 

# Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /(ox)$/i, '\1en' # inflect.singular /(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end 

# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile 

# Include your application configuration below
}}}

11/13/07 02:15:45 changed by chuyeow

I see now when you mention that the problem is with 1.2.5 and not edge like I'd thought earlier.

I believe this is caused by the patches from #6829. I've re-opened that ticket to see if anyone else can confirm this happening.