Differences between railties and engines in Ruby On Rails 3

Railtie can probably do what you describe, but it may be more desirable to use an engine. The engine can have its own configuration and also acts like a Rails application, since it allows you to include the /app directory with controllers, views and models in the same manner as a regular Rails app. Read … Read more

Render engine within application layout

I have successfully used layouts of my parent application in my engines. Firstly, based on Section 4.3.2 of the Rails Guides (Engines), in order to access the parent applications ApplicationController’s variables (like session, as you’re using above), you need to replace the engine’s application_controller.rb from this that you currently have: module Module1 class ApplicationController < … Read more

Is Cassandra production ready for Ruby on Rails?

Twitter is running rails on most of their front end. Fauna’s client is actually built and released by twitter, so you can be pretty certain that it’s up to date and stable on large workloads. Looking at the history of commits shows that there are frequent improvements being pushed to it, which is great. Most … Read more

Ruby Geolocation Gem/Plugins [closed]

Your current best bet is probably GeoKit (http://github.com/andre/geokit-gem for gem, http://github.com/andre/geokit-rails for plugin). It has built in functionality for Yahoo and Google API keys, distance calculation helpers, reverse geolocation, etc. However, GeoMereLaal (http://github.com/parolkar/geo_mere_laal/) is based on the working draft of the W3C Geolocaton API. It’s very limited at the moment as I could only get … Read more

Devise within namespace

Simply “moving” Devise to the admin namespace is wrong. Devise uses controllers like Devise::SessionsController and that cannot be “moved”. I usually create my own controllers and inherit them from Devise: class Admin::SessionsController < ::Devise::SessionsController layout “admin” # the rest is inherited, so it should work end And configure this in config/routes.rb: devise_for :admins, :controllers => … Read more

Rails 3.1 plugin gem, dummy test app, rspec

Create the plugin without test-unit and specify the path for the dummy application: rails plugin new foobar –skip-test-unit –dummy-path=spec/dummy Add rspec-rails as a development dependency to the gemspec file (foobar.gemspec): Gem::Specification.new do |s| . . . s.add_development_dependency “rspec-rails” end Run bundle install Create a symlink from the dummy app to the plugin spec directory and … Read more

Exception Notification Gem and Rails 3

All previous answers are outdated, you can now simply add this to your gemfile: gem ‘exception_notification’, :require => ‘exception_notifier’ And edit your production.rb config file as indicated in the readme: config.middleware.use ExceptionNotifier, :email_prefix => “[Exception] “, :sender_address => %{“Exception Notifier” <support@example.com>}, :exception_recipients => %w{you@me.com}

How to load vendor asset folder in Rails 4?

Any folder created directly under assets will be added to the load paths. Files in that folder can be referenced as usual like so: If you have vendor/assets/custom/js/file.js vendor/assets/custom/css/file.css then vendor/assets/custom/ will be added to the load paths. Include your files in the following files by doing the following: application.js //= require js/file application.css.scss @import … Read more

tech