Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'english'

* english:
  optimized navigation code and renamed folders
  A paragraph about Sequel::Model.raise_on_typecast_failure
  Add a link back to the full Sequel plugins list.
  • Loading branch information...
commit af39ad98439817f16294df174357c21cab89b989 2 parents 9f9cc3d + e633549
Matt Aimonetti authored
Showing with 26 additions and 10 deletions.
  1. +2 −2 app/helpers/global_helpers.rb
  2. +7 −6 app/models/page.rb
  3. 0  book-content/en/{12-recipes → 10-recipes}/1-simple-blog.markdown
  4. 0  book-content/en/{12-recipes → 10-recipes}/2-blog-slice.markdown
  5. 0  book-content/en/{16-appendix → 11-appendix}/toc.markdown
  6. 0  book-content/en/{14-deployment → 12-deployment}/1-passenger.markdown
  7. 0  book-content/en/{14-deployment → 12-deployment}/2-nginx.markdown
  8. 0  book-content/en/{14-deployment → 12-deployment}/3-jruby.markdown
  9. 0  book-content/en/{14-deployment → 12-deployment}/4-bundle.markdown
  10. 0  book-content/en/{14-deployment → 12-deployment}/toc.markdown
  11. 0  book-content/en/{15-migration-to-rails3 → 13-migration-to-rails3}/1-merb-and-rails-merge.markdown
  12. 0  book-content/en/{15-migration-to-rails3 → 13-migration-to-rails3}/toc.markdown
  13. 0  book-content/en/{16-appendix → 14-appendix}/1-hints-tips.markdown
  14. 0  book-content/en/{16-appendix → 14-appendix}/2-slices.markdown
  15. 0  book-content/en/{16-appendix → 14-appendix}/3-gems.markdown
  16. 0  book-content/en/{13-appendix → 14-appendix}/toc.markdown
  17. +12 −1 book-content/en/5-interacting-with-the-database-sequel/5-model-validation.markdown
  18. +5 −1 book-content/en/5-interacting-with-the-database-sequel/6-sequel-plugins.markdown
  19. 0  book-content/en/{8-testing-your-application → 6-testing-your-application}/1-why.markdown
  20. 0  book-content/en/{8-testing-your-application → 6-testing-your-application}/2-models.markdown
  21. 0  book-content/en/{8-testing-your-application → 6-testing-your-application}/3-requests.markdown
  22. 0  book-content/en/{8-testing-your-application → 6-testing-your-application}/4-cucumber.markdown
  23. 0  book-content/en/{8-testing-your-application → 6-testing-your-application}/toc.markdown
  24. 0  book-content/en/{9-merb-more → 7-merb-more}/1-authentication.markdown
  25. 0  book-content/en/{9-merb-more → 7-merb-more}/2-mailer.markdown
  26. 0  book-content/en/{9-merb-more → 7-merb-more}/3-caching.markdown
  27. 0  book-content/en/{9-merb-more → 7-merb-more}/4-exceptions.markdown
  28. 0  book-content/en/{9-merb-more → 7-merb-more}/5-slices.markdown
  29. 0  book-content/en/{9-merb-more → 7-merb-more}/toc.markdown
  30. 0  book-content/en/{12-recipes → 8-recipes}/toc.markdown
  31. 0  book-content/en/{11-deployment → 9-deployment}/toc.markdown
4 app/helpers/global_helpers.rb
View
@@ -24,10 +24,10 @@ def rtl_support_class
def page_nav_links(format = 'markdown')
return if params[:action] != 'show' || @page.nil? # Don't need navigation for the TOC (index).
links = []
- links << previous_page_url
+ links << previous_page_url unless @page.previous_file.include?('table-of-contents')
# Stick a link to the TOC in the middle of the array.
links << link_to(language_text(language, 'Home'), url(:toc, :language => language))
- links << next_page_url
+ links << next_page_url unless @page.next_file.include?('table-of-contents')
links.join(' | ')
end
13 app/models/page.rb
View
@@ -38,7 +38,7 @@ def next_file
return @next_file unless @next_file.nil?
n_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number}-*/#{page_number + 1}-*.*"].entries.first
if n_file.nil?
- n_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number + 1}-*/**"].entries.first
+ n_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number + 1}-*/toc.*"].entries.first
# We're on the last page of the last chapter, just return the TOC.
n_file = "#{Merb.root}/book-content/#{language}/table-of-contents" if n_file.nil?
end
@@ -61,7 +61,8 @@ def previous_file
return @previous_file unless @previous_file.nil?
p_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number}-*/#{page_number - 1}-*.*"].entries.first
if p_file.nil?
- p_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number - 1}-*/**"].entries.last
+ p_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number - 1}-*/[0-9]*?*.*"].entries.last
+ p_file = Dir["#{Merb.root}/book-content/#{language}/#{chapter_number - 1}-*/toc.*"].entries.first if p_file.nil?
# We're on the last page of the last chapter, just return the TOC.
p_file = "#{Merb.root}/book-content/#{language}/table-of-contents" if p_file.nil?
end
@@ -91,8 +92,8 @@ def find_page_file
end
def extract_chapter_and_page_number
- file =~ /book-content\/\w{2}\/(\d{1,})-[a-z-]+\/(\d{1,})-[a-z-]+[.]\w+/
- @chapter_number, @page_number = $1.to_i, $2.to_i
+ file =~ /book-content\/\w{2}\/(\d{1,})-[a-z-]+\/((\d{1,})-[a-z-]+|toc)[.]\w+/
+ @chapter_number, @page_number = $1.to_i, $3.to_i
end
def extract_next_chapter_and_page_name
@@ -105,8 +106,8 @@ def extract_previous_chapter_and_page_name
# Returns an array with the chapter name and the page name of the file to process
def extract_chapter_and_page_number_for_file(file_to_process)
- file_to_process.grep(/book-content\/\w{2}\/\d{1,}-([a-z-]+)\/\d{1,}-([a-z-]+)[.]\w+/)
- [$1, $2]
+ file_to_process.grep(/book-content\/\w{2}\/\d{1,}-([a-z-]+)\/(\d{1,}-([a-z-]+)|(toc))[.]\w+/)
+ [$1, $3]
end
end
0  book-content/en/12-recipes/1-simple-blog.markdown → book-content/en/10-recipes/1-simple-blog.markdown
View
File renamed without changes
0  book-content/en/12-recipes/2-blog-slice.markdown → book-content/en/10-recipes/2-blog-slice.markdown
View
File renamed without changes
0  book-content/en/16-appendix/toc.markdown → book-content/en/11-appendix/toc.markdown
View
File renamed without changes
0  book-content/en/14-deployment/1-passenger.markdown → book-content/en/12-deployment/1-passenger.markdown
View
File renamed without changes
0  book-content/en/14-deployment/2-nginx.markdown → book-content/en/12-deployment/2-nginx.markdown
View
File renamed without changes
0  book-content/en/14-deployment/3-jruby.markdown → book-content/en/12-deployment/3-jruby.markdown
View
File renamed without changes
0  book-content/en/14-deployment/4-bundle.markdown → book-content/en/12-deployment/4-bundle.markdown
View
File renamed without changes
0  book-content/en/14-deployment/toc.markdown → book-content/en/12-deployment/toc.markdown
View
File renamed without changes
0  ...gration-to-rails3/1-merb-and-rails-merge.markdown → ...gration-to-rails3/1-merb-and-rails-merge.markdown
View
File renamed without changes
0  book-content/en/15-migration-to-rails3/toc.markdown → book-content/en/13-migration-to-rails3/toc.markdown
View
File renamed without changes
0  book-content/en/16-appendix/1-hints-tips.markdown → book-content/en/14-appendix/1-hints-tips.markdown
View
File renamed without changes
0  book-content/en/16-appendix/2-slices.markdown → book-content/en/14-appendix/2-slices.markdown
View
File renamed without changes
0  book-content/en/16-appendix/3-gems.markdown → book-content/en/14-appendix/3-gems.markdown
View
File renamed without changes
0  book-content/en/13-appendix/toc.markdown → book-content/en/14-appendix/toc.markdown
View
File renamed without changes
13 book-content/en/5-interacting-with-the-database-sequel/5-model-validation.markdown
View
@@ -48,7 +48,18 @@ If validation fails, errors can be accessed on the object with the `#errors` met
=> 'is too short'
{:lang=ruby html_use_syntax=true}
-
+By default, Sequel will also not allow unexpected data into a column.
+If the table schema prevents a column from containing a nil value, it can not be set to nil.
+Sequel attempts to typecast entered values to match their column type.
+This can be disabled by setting the class attr\_accesor `raise_on_typecast_failure` to false.
+
+ a => Address.new(:user_id => 1, :city => 'A City')
+ a.user_id = nil
+ Sequel::Error::InvalidValue: nil/NULL is not allowed for the user_id column
+ Address.raise_on_typecast_failure = false
+ a.user_id = nil
+ => nil
+
A full set of documentation for model validations can be found in the [Merb::Sequel documentation][]
6 book-content/en/5-interacting-with-the-database-sequel/6-sequel-plugins.markdown
View
@@ -5,6 +5,8 @@ Sequel Plugins are libraries packaged as gems which can add useful functionality
Plugins are named like `sequel_pluginname`.
They're used in models by declaring `is :pluginname`.
Plugins for Sequel are painless to use, and are easy to write.
+These are just a few examples.
+Jeremy Evans maintains a more [complete list of plugins][].
##Useful Plugins
@@ -79,6 +81,8 @@ There is, however, a migration included in the plugin source.
Sequel\_taggable depends on the sequel\_polymophic plugin.
Here's the [sequel\_taggable source][].
+[complete list of plugins]: http://sequel.rubyforge.org/plugins.html
+
[sequel_timestamped source]: http://github.com/bricooke/sequel_timestamped/tree/master
[sequel_notnaughty source]: http://github.com/boof/sequel_notnaughty/tree/master
@@ -87,4 +91,4 @@ Here's the [sequel\_taggable source][].
[sequel_polymorphic source]: http://github.com/jackdempsey/sequel_polymorphic/tree/master
-[sequel_taggable source]: http://github.com/jackdempsey/sequel_taggable/tree/master
+[sequel_taggable source]: http://github.com/jackdempsey/sequel_taggable/tree/master
0  ...tent/en/8-testing-your-application/1-why.markdown → ...tent/en/6-testing-your-application/1-why.markdown
View
File renamed without changes
0  ...t/en/8-testing-your-application/2-models.markdown → ...t/en/6-testing-your-application/2-models.markdown
View
File renamed without changes
0  ...en/8-testing-your-application/3-requests.markdown → ...en/6-testing-your-application/3-requests.markdown
View
File renamed without changes
0  ...en/8-testing-your-application/4-cucumber.markdown → ...en/6-testing-your-application/4-cucumber.markdown
View
File renamed without changes
0  ...ontent/en/8-testing-your-application/toc.markdown → ...ontent/en/6-testing-your-application/toc.markdown
View
File renamed without changes
0  ...-content/en/9-merb-more/1-authentication.markdown → ...-content/en/7-merb-more/1-authentication.markdown
View
File renamed without changes
0  book-content/en/9-merb-more/2-mailer.markdown → book-content/en/7-merb-more/2-mailer.markdown
View
File renamed without changes
0  book-content/en/9-merb-more/3-caching.markdown → book-content/en/7-merb-more/3-caching.markdown
View
File renamed without changes
0  book-content/en/9-merb-more/4-exceptions.markdown → book-content/en/7-merb-more/4-exceptions.markdown
View
File renamed without changes
0  book-content/en/9-merb-more/5-slices.markdown → book-content/en/7-merb-more/5-slices.markdown
View
File renamed without changes
0  book-content/en/9-merb-more/toc.markdown → book-content/en/7-merb-more/toc.markdown
View
File renamed without changes
0  book-content/en/12-recipes/toc.markdown → book-content/en/8-recipes/toc.markdown
View
File renamed without changes
0  book-content/en/11-deployment/toc.markdown → book-content/en/9-deployment/toc.markdown
View
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.