Created
          February 7, 2012 20:43 
        
      - 
      
- 
        Save parndt/1761816 to your computer and use it in GitHub Desktop. 
    Seeding in a few locales
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | page_position = -1 | |
| I18n.locale = :en | |
| tuning_page = Page.create(:title => "Tuning", :deletable => true, :position => (page_position += 1)) | |
| I18n.locale = :fr | |
| tuning_page.title = 'French Tuning' | |
| tuning_page.save | |
| I18n.locale = :es | |
| tuning_page.title = 'Spanish Tuning' | |
| tuning_page.save | |
| # You should now have one page with 3 locales. | |
| I18n.locale = :en | |
| another_page = Page.create(:title => 'Another', :deletable => true, :position => (page_position += 1)) | |
| I18n.locale = :fr | |
| another_page.title = 'Another French' | |
| another_page.save | |
| I18n.locale = :es | |
| another_page.title = 'Another Spanish' | |
| another_page.save | |
| # You should now have 2 pages with 3 locales each. | |
| # hope this helps | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment