ruby

Is Netbeans equally awesome for Ruby development on the Mac?

I realize most Ruby development on the Mac uses Textmate but I love Netbeans in the Windows environment and am wondering whether it's equally awesome on the Mac - even if it's swimming against the stream a little bit, would Netbeans pose any issues as a Ruby IDE on the Mac? ...

Why does instance_eval() define a class method when called on a class?

Foo = Class.new Foo.instance_eval do def instance_bar "instance_bar" end end puts Foo.instance_bar #=> "instance_bar" puts Foo.new.instance_bar #=> undefined method ‘instance_bar’ My understanding is that calling instance_eval on an object is supposed to allow you to define an instance variable or method for that object...

Using Rails with Paperclip and SWFUpload

I have a basic rails application test with a user model that has a photo field handled with paperclip. I created the views to be able to create/edit an user and the photo uploading is working nicely. <h1>Editing user</h1> <% form_for :user, @user, :url => user_path(@user), :html => { :method => "put", :multipart => true } do |f| %> ...

Setting Ruby Load Path Externally

I have a custom Ruby library directory that I'd like to have automatically added to Ruby's load path whenever Ruby is executed. I know I can use the -I option to Ruby, but I'm wondering if there is something like an environment variable that I can set that will globally determine Ruby's load path. As an aside, my high level task is to ...

What are the major differences between PHP and Ruby?

I need a quick overview to figure out if it's worth switching from PHP to ruby. Please list some differences you know. I'm just talking about PHP and Ruby, not Ruby on Rails (that would be a bad comparison). ...

Does Google use Ruby for application development?

Does anyone know if Google uses Ruby for application development? What are the general job prospects of Ruby compared to other languages like Perl or Python? ...

Running laika within netbeans with jruby 1.1.6

I'm Ruby/Rails newbie and trying to get the laika tool (http://github.com/CCHIT/laika/tree/master) running within NetBeans IDE. I'm getting the following exception. I'm using NetBeans IDE 6.5.1, JRubby 1.1.6 and GlassFish V3. Any ideas what might be wrong? INFO: Jruby version is: 1.1.6 INFO: Starting Rails instances SEVERE: Exception...

Rails: Keeping user spoofing checks DRY

In a fit of unoriginality, I'm writing a blog application using Ruby on Rails. My PostsController contains some code that ensures that the logged in user can only edit or delete their own posts. I tried factoring this code out into a private method with a single argument for the flash message to display, but when I did this and tested i...

ruby on rails x charset

hi, i'm having problem to deal with charset in ruby on rails app, specificially in my templates. Code that comes from my database, works fine, but codes like ç ~ that are located in my views are not working. I added the following codes to my code I added a function like that, but that still not working i have ç ~ codes in my application...

How to get an eager loaded conditional to be lazy loading later on with ActiveRecord and Rails

First let me show some code. class User has_and_belongs_to_many :roles named_scope :employees, { :conditions => ["roles.name = 'Employee'"], :include => :roles } end OK, so later in a controller I wanted to search for all the employees right. I set the named scope up to help do that with the join and conditional search. But the pr...

Rails: How to override stylesheet_path

Hi, I've been trying to override Rails' stylesheet_path helper, but I haven't found a way how. I can't just open the ActionView::Helpers::AssetTagHelper module and override it there, because Rails won't pick up my new method. I know it's probably because the module gets mixed in, so how do I get around that? ...

Unable to use TicGit: Problem with Ruby

I am trying to use Ticgit by running ti I get the following error message /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- git (LoadError) from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /opt/local/lib/ruby/ge...

How to get product information from amazon, just based on the URL?

I just have a link to a product page, at amazon. How do I get all the information (photo, price etc), in my ruby program, just using this link? ...

How to get long URL from short URL?

Using Ruby, how do I convert the short URLs (tinyURL, bitly etc) to the corresponding long URLs? ...

How Do I Learn to Put it All Together

I've gone through several tutorials in various languages (currently working my through the Agile Web Development with Rails book for an attempt at practical learning) and on their own, these tutorials don't seem to give a good big picture of development. You can learn how to write arrays, define variables and several other concepts but ...

Ruby - How to catch all HTTP traffic (local proxy)

Dear StackOverflow Community, I am looking to get access to all HTTP traffic on my machine (my windows machine - not a server). From what I understand having a local proxy through which all traffic routes is the way to go. I have been Googling but failed to find any resources (in respect to Ruby) to help me out. Any tips or links are mu...

What is SSH forwarding?

I read a guide. It says that run the following line and forget it. /usr/bin/ssh-add -K I am not sure when and where I should use it. What is SSH forwarding? ...

Unable to find a tab completion for Rubygem in Bash/Zsh

I have not found a tab-completion script for RubyGem in Bash/Zsh. Where can you get the tab-completion script for RubyGem in Bahs/Zsh? ...

says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company?

says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company? If i ssh to my hosting company and type rails -v, i get 2.2.2... so looks like they might be using Rails 2.2.2. So if i develop a Rails app on my Macbook and ftp all files over there, will the Passenger...

is using threads and ruby mechanize safe ?

Does anyone ever see alot of errors like this: Exception `Net::HTTPBadResponse' at /usr/lib/ruby/1.8/net/http.rb:2022 - wrong status line: SOME HTML CODE HERE When using threads and mechanize? I'm relatively certain that this is some bad behavior between threads and the net/http library, but does anyone have any advice as far as the upp...