ruby

Using tarantula to test a Rails app

I'm using Tarantula to test a Rails app I'm developing. It works pretty well, but I'm getting some strange 404s. After looking into it, Tarantula is following DELETE requests (destroy actions on controllers) throughout my app when it tests. Since Tarantula gets the index action first (and seems to keep a list of unvisited URLs), it ev...

What is the best WYSIWYG for Rails - Ruby on Rails Blog

What is the best way to allow for the adding of images and embedding of video in the body:text field of a Ruby on Rails blog. I understand that I can use an attachment like Paperclip to add a photo to a record but I am wondering how to get images/vids into the actual body of the post. ...

MongoDB ruby dates

I have a collection with an index on :created_at (which in this particular case should be a date) From rails what is the proper way to save an entry and then retrieve it by the date? I'm trying something like: Model: field :created_at, :type => Time script: Col.create(:created_at => Time.parse(another_model.created_at).to_s and Co...

Continuous build integration tool for Rails and PHP?

Most of "multi-platform" CI tools I've seen are in the Java/.NET world, like TeamCity or Hudson. Is there a continuous integration tool that can handle both PHP and Rails projects? ...

Problem serving video to iPad from Mongrel 1.1.5 , RoR 2.0.2 on Mac OS 10.6.3 Server

I am working off the Final Cut Server Integration sample provided by Apple that is a Rails app using 2.0.2 and runs on Mongrel 1.1.5. I can have a basic non-Ruby directory on my boot volume (Mac OS 10.6.3 Server) and can serve up video files just fine to iPad. However, when I drag the same video file into the 'public' area of the app run...

Problem loading activemerchant using Bundler

Hi - I am using Merb. I can't seem to get activemerchant to load using Bundler. All my other gems load fine. In my Gemfile I am using: gem 'activemerchant', :require => 'active_merchant' Here is the relevant error: uninitialized constant ActiveMerchant::Billing::AuthorizedNetGateway Anyone run into this or have any ideas? Thank...

Sinatra Title Slugs

I'm trying to create a slug helper in Sinatra. Here's the code (as seen here): helpers do def sluggify(title) accents = { ['á','à','â','ä','ã'] => 'a', ['Ã','Ä','Â','À'] => 'A', ['é','è','ê','ë'] => 'e', ['Ë','É','È','Ê'] => 'E', ['í','ì','î','ï'] => 'i', ['Î','Ì'] => 'I', ['ó','ò','ô','ö','õ'] => 'o', ...

Exporting an Environment Variable in Ruby

How do I export an environment variable from within a Ruby script to the parent shell? For example, implementing a naïve implementation of the read Bash builtin: #!/usr/bin/ruby varname = ARGV[0] ENV[varname] = STDIN.gets # but have varname exported to the parent process ...

Send instance method to module

Given the following module, module Foo def bar :baz end end def send_to_foo(method) # ...? end send_to_foo(:bar) # => :baz What code should go in send_to_foo to make the last line work as expected? (send_to_foo is obviously not how I would implement this; it just makes clearer what I'm looking for.) I expected Foo.send(:b...

Suppress/Override application.html.erb

Is there any way to suppress the default js and css loaded by application.html.erb on a view by view basis? I'm finding it incredibly difficult to manage a global css and js includes configuration when certain views need different js libraries that for some reason seem to be conflicting with one another. For example, I might want jquery ...

How to know when an instance variable gets set in Ruby

Is there any way to override the setting of instance variables in Ruby? Lets say I set an instance variable: @foo = "bar" Can I intercept that and do something (like record it or puts, for instance) I suppose, I am trying to override the assignment operator for all types. Can this even be done? The best I have come up with, so far...

Installing Paperclip - "undefined method `has_attached_file` for" - Ruby on Rails

I just installed the plugin for Paperclip and I am getting an error message "undefined method has_attached_file for. Not sure why I am getting this. Here is the full error message. NoMethodError (undefined method `has_attached_file' for #<Class:0x10338acd0>): /Users/bgadoci/.gem/ruby/1.8/gems/will_paginate-2.3.12/lib/will_paginate/fi...

Ruby Rss parser and event trigger

I'm using RSS library so i can parse Atom and RSS in Ruby and Rails and store it in a model. I've looked at the standard RSS library, but is there one library that will auto-detect that there is a new rss feed so i can update my database ? what are the best practice to trigger an instruction in order to store the new rss feed ? should ...

Updating RubyGems alongside an existing packaged installation on Joyent

On a Joyent accelerator I'm working with, Ruby and Rubygems were installed when the server was initially setup using Cool Stack. The existing version of Rubygems is version 0.9.2. When it comes to upgrading RubyGems using the 'sudo gem install rubygems-update' and 'sudo update_rubygems' commands, it results in the following error: ./li...

Search by price interval in currency and other params using Searchlogic

Hi I need to reaqlize search in product model with prices in different currencies (price and currecny_id field). Every currency have own rate. When user search for product in price range [x, y] USD, range must be converted to all currencies and return values like (price > from_eur AND price < to_eur AND currecny_id = 1) OR (price > fr...

How to update EXIF tags of a picture file in Ruby ?

Title says everything. ...

Require 'RMagick' not working?

I have installed RMagick on OSX via MacPorts and can see it by running 'gem server'. However when I try to include it in my script using require 'rubygems' require 'RMagick' It crashes with the following error message ./RMagick.rb:4:in `show_info': uninitialized constant Magick (NameError) from ./RMagick.rb:24 from /System...

WYSIHAT 'resonds_to_parent" undefined method - Ruby on Rails

I just successfully installed WysiHat in my rails blog. Seems that the 'add a picture' feature is not working. It successfully allows me to find and select a picture from my desktop but upon clicking save, it does nothing. I also have Paperclip successfully installed and can attach images to records outside the WYSIHAT form field. An...

WYSIWYG displaying as HTML in view - Ruby on Rails

I have had this problem w/ two seperate WYSWYG editors in my rails application so I think it has something to do with modifying the way that the filed is being displayed. In my Post table the field I am attempting to affect is called body. When I use the WYSIWYG editor and save it, the display from the both the index and the show views...

Ruby on Rails ActiveSupport or plain Ruby way of merging arrays into a hash

What's a smart way of using ActiveSupport or perhaps regular built in Ruby functionality to take two arrays and merge them into a hash where each element in an array matches the element in a parallel array? imagine two arrays: names = ["Danny", "Johnny"] ages = ["25", "32"] The end result should be a hash that looks like: {"Danny" =>...