Rails flash notice via ajax

Here is an example that I got working, thanks to Rich Peck’s answer. I needed to use flash.now to make sure the flash notice didn’t persist. AJAX trigger in the view: <%= link_to “Email report”, users_path, remote: true %> Controller: # app/controllers/users_controller class UsersController < ApplicationController def index # do some things here respond_to do … Read more

Is the ‘Travel’ time helper not available in feature specs?

In order to use these helpers you have to include them into your tests. You can do this by either including it into single test suite: describe MyClass do include ActiveSupport::Testing::TimeHelpers end or globally: RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers end

Why “bundle install” a gem instead of “gem install” for a rails 3 app?

Using bundler instead of gem command to directly install your gems gives you a whole lot of benefits. In this specific case where you suggest using the gem command to install and adding it later to the Gemfile, bundler will resolve all the dependencies for you when you install a gem, which you might have … Read more

how to require active record working outside of rails

Here’s how I’m using ActiveRecord outside of Rails: #!/usr/bin/ruby require ‘active_record’ require ‘mysql2’ # or ‘pg’ or ‘sqlite3’ ActiveRecord::Base.establish_connection( adapter: ‘mysql2’, # or ‘postgresql’ or ‘sqlite3’ database: ‘DB_NAME’, username: ‘DB_USER’, password: ‘DB_PASS’, host: ‘localhost’ ) # Note that the corresponding table is ‘orders’ class Order < ActiveRecord::Base end Order.all.each do |o| puts “o: #{o.inspect}” end

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)