ruby-on-rails-plugins

Is Cassandra production ready for Ruby on Rails?

I'm working on a project that is considering using Cassandra as a database. We would like to eventually migrate to Cassandra even if we use MySQL to start with, given its scalability. I know that big companies like Facebook, Digg, and recently Twitter is using Cassandra, but I don't believe any of those sites run off Rails. My questio...

Adding to ActiveRecord::ConnectionAdapters::MysqlAdapter

For general knowledge and entertainment purposes I am trying to add some behavoiur to Rails. What I am looking for is simply to run a Mysql "EXPLAIN" statement before every select statement that Rails runs. I think this should work ok but I am getting the error: /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext...

file_column not creating files, just empty tmp directory

Up to the end of December 2009 everything worked fine, so i assume that after some upgrades on servers (Ubuntu 8.10 and second Ubuntu 9.10) something stopped working. Model: class Product < ActiveRecord::Base belongs_to :category file_column :thumbnail, :magick => { :geometry => "150x100>" } there is of course table 'products' in d...

Heroku Gem Doesn't work are installing it

I am trying to get heroku running on Unbuntu 9.10 I typed sudo gem install heroku and everything works fine but then when I go to run: heroku list I get heroku: command not found ...

Mixing acts_as_tree (ancestry gem), acts_as_list and default model scoping

I'm using the ancestry gem to structure some groups in a tree. At the same time I'm using acts_as_list to keep groups at the same tree level in a sorted list. Given the following model: class Group < ActiveRecord::Base acts_as_tree acts_as_list :scope => "ancestry" named_scope :parentable, :conditions => "NOT type = 'PriceGroup'"...

How to extend an 'unloadable' Rails plugin?

I'm trying to write a plugin that will extend InheritedResources. Specifically I want to rewrite some default helpers. And I'd like it to "just work" once installed, w/o any changes to application code. The functionality is provided in a module which needs to be included in a right place. The question is where? :) The first attempt w...

MD5 wrong number of arguments (1 for 0) Error

Hi All, I have following error on my Server which is working properly on my local on following line . event_id = MD5.new("event-init-flash-#{Asteroid::now}").to_s #line 232 ERROR: wrong number of arguments (1 for 0) /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:232:in `initialize' /ruby/gems/gems/shooting_sta...

Multiple model search result sorting by date time field value

I am using ultraspinx rails plugin in a project to handle the search module. Sphinx uses more than one model for searching the content(for eg: Discussion and Comments). I need to sort the output by created at descending, which is available in both models. While searching in internet I found that we need to use the following options with...

Ruby/Rails display general screen when modifications being performed on server

I have a ruby on rails app running a server and sometimes it needs to be taken down for updates/etc. As of now, one way I see to have a general display screen during update periods (when the app is down) is to substitute the files within /srv/www/ directory to just have it display a general screen everywhere that the user could possibly...

Testing a patch to the Rails mysql adapter

I wrote a little monkeypatch to the Rails MySQLAdapter and want to package it up to use it in my other projects. I am trying to write some tests for it but I am still new to testing and I am not sure how to test this. Can someone help get me started? Here is the code I want to test: unless RAILS_ENV == 'production' module ActiveR...

How to pre-process CSV data for FasterCSV?

We're having a significant number of problems creating a bulk upload function for our little app. We're using the FasterCSV gem to upload data to a MySQL database but he Faster CSV is so twitchy and precise in its requirements that it constantly breaks with malformed CSV errors and time out errors. The csv files are generally created b...

Two Rails applications, one userbase, looking for a simplest solution to handle this

I have two Rails applications, let's call them A and B. A has existing user base and i want these users to be able to log in to B with the username and password managed in A. B is altered version of Altered Beast forum and it would be nice if users of my application do not have to create another user account to use forum. My initial tho...

How can I prevent Rails from "pluralizing" a column name?

I'm using dwilkie's foreigner plugin for rails. I have a table creation statement that looks like: create_table "agents_games", :force => true, :id => false do |t| t.references :agents, :column => :agent_id, :foreign_key => true, :null => false t.references :games, :column => :game_id, :foreign_key => true, :null => false e...

Rails Tableless Model

I'm creating a tableless Rails model, and am a bit stuck on how I should use it. Basically I'm trying to create a little application using Feedzirra that scans a RSS feed every X seconds, and then sends me an email with only the updates. I'm actually trying to use it as an activerecord model, and although I can get it to work, it doesn...

Writing tests for Rails plugins

I'm working on a plugin for Rails that would add limited in-memory caching to ActiveRecord's finders. The functionality itself is mature enough, but I can't for the life of me get unit tests to work with the plugin. I now have under vendor/plugins/my_plugin/test/my_plugin_test.rb a standard subclass of ActiveSupport::TestCase with a cou...

How to force reload all vendor/plugins in rails 2.3 (development mode)

We have an application with a app/model that references another model stored in a plugin. When the app/model level is reloaded on the second and further requests and that relies on our model in vendor/plugins/... (which stays loaded) it fails (can't dup nil class). We've tried setting config.reload_plugins = true in the development.rb...

Finding related tags using acts-as-taggable-on

In tag#show I list all entries with that tag. At the bottom of the page I'd like to have something like: "Related Tags: linked, list, of, related tags" My view looks like: <h2><%= link_to 'Tag', tags_path %>: <%= @tag.name.titleize %></h2> <% @entries.each do |entry| %> <h2><%= link_to h(entry.name), entry %></h2> <%- unless entry...

Testing Paypal error messages using ActiveMerchant

Hello, Is there a way to test your application's processing and handling of Paypal generated credit card errors? I'd like to verify that my application can handle a declined credit card or something like that. So is there a way to have Paypal send an error message? Or would it be better to generate a stub and use it in the testing envi...

Ruby on Rails function grapher

Hi, I'm looking for a function grapher that I can use in a small Rails application I'm working on for my university. Is there anything out there? If it needs the values (points) is not a problem but it would be better if it just parsed the equation. The functions will be 100% in ruby format (for example Math.exp(3*x))... Thanks a lot! ...

Rails Counter Cache and its implementation

Hello All, I am trying to get hold of rails counter cache feature but not able to grasp it completely. Let's say that We have 3 models A B C A belongs to B or C depending upon a field key_type and key_id. key_type tells whether A belongs to B or C so if key_type="B" then the record belongs to B otherwise it belongs to C. In my mode...