RSPEC – no such file to load — action_controller/integration
When using rspec + webrat for unit testing, always pop up the error on the line: visit(edit_user_path(user))
Failure/Error: visit('/users/edit/1')
LoadError:
no such file to load -- action_controller/integration
If you confirmed that you have no problem with your routes.rb
The quick fix is go to spec_helper.rb
require "webrat"
require 'webrat/core/matchers'
include Webrat::Methods
Ruby on Rails Security Google group page
https://groups.google.com/forum/?fromgroups=#!forum/rubyonrails-security
Deleting Fragment Cache in Model or Console
I’ve done a little research and found out how to delete fragmented cache in Model level or in console
<% cache('all_available_products') do %>
All available products:
<% end %>
To remove it this fragment cache from Model or Console:
Rails.cache.delete("all_available_products")
To remove it from Controller:
expire_fragment('all_available_products')
Source:
http://guides.rubyonrails.org/caching_with_rails.html#fragment-caching
How to setup Ruby on Rails Development on Mac OS X Mountain Lion
I’ve search through Google on how to setup Ruby on Rails Development on Mountain Lion OS and here are some helpful links I’ve found.
http://newbieonruby.com/installing-ruby-and-rails-on-mountain-lion/
http://hathaway.cc/2012/04/how-to-setup-mac-os-x-lion-for-ruby-and-rails-development/
http://blog.wyeworks.com/2012/4/13/my-osx-rails-installation-using-homebrew-and-rbenv-step-by-step/
My setup work with:
- Homebrew
- rbenv
- ruby-build
- bundler
- rails
- MySQL
Hope this one help
How to create Mail Interceptor
Are you working on mail sending on your local machine and doesn’t want to send an actual email? Try using this one:
Im using Rails 3 in this setup.
1) Create this file under your appname/lib/development_mail_interceptor.rb
class DevelopmentMailInterceptor
def self.delivering_email(message)
message.subject = "#{message.to} #{message.subject}"
message.to = "michael@cebudirectories.com"
end
end
2) Create this file in appname/config/initializers/setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "example.com",
:user_name => "username",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}
if Rails.env.development?
ActionMailer::Base.default_url_options[:host] = "localhost:3000"
else
ActionMailer::Base.default_url_options[:host] = "example.com"
end
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
Done!
Hope this will help you…
Typeplate – A typographic starter kit
Typeplate is a “typographic starter kit”. We don’t make aesthetic design choices, but define proper markup with extensible styling for common typographic patterns. A stripped-down Sass library concerned with the appropriate technical implementation of design patterns—not how they look.
Here’s the link to there demo:
http://typeplate.com/demo.html
I’ve found this useful Magento API written in Ruby.
Thanks to Guwen
Source: https://gist.github.com/1875404/
Solution when bundle install error – gem linecache
/Users/macmini/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
Can’t handle 1.9.x yet
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/Users/macmini/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
Gem files will remain installed in /Users/macmini/.rvm/gems/ruby-1.9.2-p290/gems/linecache-0.46 for inspection.
Results logged to /Users/macmini/.rvm/gems/ruby-1.9.2-p290/gems/linecache-0.46/ext/gem_make.out
An error occurred while installing linecache (0.46), and Bundler cannot continue.
Make sure that `gem install linecache -v ’0.46′` succeeds before bundling.
Solution:
In you Gemfile, change ruby-debug to ruby-debug19 and do a bundle install.
Hope it works for you.
Remote links and forms
A good post about Rails 3 remote links and forms by: Steve Schwartz
http://www.alfajango.com/blog/rails-3-remote-links-and-forms
Thank you Steve
Markdown for your github Readme.md file
Here’s a good post by John Gruber.

Recent Comments