"Using MongoMapper to find all users that :name column is not null", this is all I want.
To do so, use this query:
User.where(:name.ne => nil).all
User.all(:name.ne => nil)| # in ApplicationController | |
| before_filter do |controller| | |
| authenticate if Rails.env.production? | |
| end | |
| def authenticate | |
| authenticate_or_request_with_http_basic do |username, password| | |
| username == ENV["auth_user"] && password == ENV["auth_password"] | |
| end |
| require 'cgi' | |
| CGI.escape(url) |
| $("#some_checkbox").click (e) -> | |
| if $(this).is(':checked') | |
| # actions when checked | |
| else | |
| # actions when not checked |
| <%= stylesheet_link_tag "main.css", :media => "all" %> | |
| <%= stylesheet_link_tag "retina.css", :media => "only screen and (-webkit-min-device-pixel-ratio: 2)" %> |
image_tag("rails.png")のhelper methodで生成するリンクはデフォルトでは同じホストのpublicフォルダを指しています。それを変更したい場合はconfig/environments/production.rbのActionController::Base.asset_hostをいじります。
ActionController::Base.asset_host = "assets.example.com"image_tag("rails.png")
# => <img alt="Rails" src="http://assets.example.com/images/rails.png?1230601161" />| # under /Users/username/.rvm/gems/ruby-1.9.2-p290/gems/turn-0.8.3/lib/turn/autorun/minitest.rb | |
| require 'turn/autoload' | |
| require 'minitest/unit' | |
| require 'minitest/spec' | |
| require 'turn/colorize' | |
| require 'turn/controller' | |
| require 'turn/runners/minirunner' |
| # this will work | |
| <% unless defined?(:show_author) %> | |
| <% show_author = true %> | |
| <% end %> | |
| # NOT work | |
| <% show_author = true unless defined?(:show_author) %> | |
| # this will work | |
| <% show_author = true unless local_assigns.has_key? :show_author %> |
| $ echo $SHELL | |
| $ chsh -s /bin/tcsh |
| # in your view erb file | |
| <%= link_to_function "test js", '$(this).html("js works")' %> | |
| # in test spec | |
| it "supports js", :js => true do | |
| visit tasks_path | |
| click_link "test js" | |
| page.should have_content("js works") | |
| end |