This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| <%= form_for(@user) do |f| %> | |
| <% if @user.errors.any? %> | |
| <div id="error_explanation"> | |
| <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2> | |
| <ul> | |
| <% @user.errors.full_messages.each do |msg| %> | |
| <li><%= msg %></li> | |
| <% end %> | |
| </ul> |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| # The output is double the input value | |
| ActiveSupport::SecureRandom.hex(3) |
The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]
jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]
Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]
The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]
| #!/bin/sh | |
| # | |
| # Just save this as .git/hooks/post-checkout in your Rails application | |
| # | |
| env ARCHFLAGS="-arch x86_64" bundle install | |
| touch tmp/restart.txt |
| var next_path; | |
| var form_stages; | |
| var check_a; | |
| var check_s; | |
| var prev_path; | |
| var field_val; | |
| ;(function($) { | |
| var app = new Sammy.Application(function() { | |
| with(this) { | |
| get('#/stage/:id', function() { with(this) { |
| //get first part of current url, without hash | |
| var base_path = window.location.href.split("#")[0]; | |
| var real_id = 0; | |
| var current_page; | |
| ;(function($) { | |
| //create new sammy app | |
| var app = new Sammy.Application(function() { | |
| with(this) { | |
| //corresponds to routes like #/slide/1 | |
| get('#/slide/:page_id', function() { with(this) { |
| $(function() { | |
| //run the accordion plugin, set height of sections to height of content | |
| $("#accordion").accordion({ autoHeight: false }); | |
| }); | |
| ;(function($) { | |
| //write new sammy application | |
| var app = new Sammy.Application(function() { | |
| with(this) { | |
| //corresponds to routes such as #/section/1 | |
| get('#/section/:section_id', function() { with(this) { |
| # Helps to organize and structure your tests with | |
| # * human readable test names | |
| # * flagging tests as pending | |
| # * structuring the test implementation with blocks | |
| # Please see the documentation of single methods below. | |
| # Written by Vladimir Dobriakov | |
| # See http://blog.geekq.net/2009/11/25/minimalist-testing-ruby/ for explanation | |
| require 'test/unit' | |
| class << Test::Unit::TestCase |