#MySQL
User.find(:all,'RAND()',:limit =>5)
#PostgreSQL,SQLite
User.find(:all,'RANDOM()',:limit =>5)
User.find(:all,'RAND()',:limit =>5)
#PostgreSQL,SQLite
User.find(:all,'RANDOM()',:limit =>5)
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6b1.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.ajaxLinksEnabled = false;
});
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<a link="#" rel="external">Link Text</a>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6b1.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.ajaxFormsEnabled = false;
});
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<form data-ajax="false">
.
.
</form>
# # Backup # Generated Template # # For more information: # # View the Git repository at https://github.com/meskyanichi/backup # View the Wiki/Documentation at https://github.com/meskyanichi/backup/wiki # View the issue log at https://github.com/meskyanichi/backup/issues # # When you're finished configuring this configuration file, # you can run it from the command line by issuing the following command: # # $ backup -t my_backup [-c] #Set database name,password refer to 'database.yml' database_yml = File.expand_path('../config/database.yml', __FILE__) RAILS_ENV = ENV['RAILS_ENV'] || 'development' require 'yaml' config = YAML.load_file(database_yml) Backup::Model.new(:my_backup, 'My Backup') do database MySQL do |db| db.name = config[RAILS_ENV]["database"] db.username = config[RAILS_ENV]["username"] db.password = config[RAILS_ENV]["password"] db.host = "localhost" db.port = 3306 db.socket = "/tmp/mysql.sock" db.skip_tables = [] end #Refer to Databases if want to use other database. store_with FTP do |server| server.username = 'my_username' server.password = 'my_password' server.ip = '123.45.678.90' server.port = 21 server.path = '~/backups/' server.keep = 5 #number of backups end #Refer to Storages if want to use other strage.compress_with Gzip do |compression| compression.best = true compression.fast = false end end
every 1.days, :at=>'05:00' do command "backup perform --trigger my_backup --config_file 'rails_app/current/config'" end*Options
module UserHelpers def user_helper_method #do something end end describe User include UserHelpers . . . endShare in all specs
RSpec.configure do |config| config.include(UserHelpers) end
module CustomMatcher def matcher_something #define custom matcher end end
. . . require 'spec/rails' require File.dirname(__FILE__) + "/custom_matchers" ・ ・ Spec::Runner.configure do |config| . . config.fixture_path = RAILS_ROOT + '/spec/fixtures/' config.include(CustomMatcher)And matcher_someting is enabled.
def before_create self.created_at = Time.now if self.created_at.blank? self.updated_at = Time.now if self.updated_at.blank? endThis method will fix the problem.