ruby

Is there a rails plugin for uploading bulk items to eBay?

Hi, I made a rails app that generates HTML code for eBay product description. Currently my client copies the HTML code to the eBay site manually. I wonder if I can automate the process. Of course, I don't want to start from scratch. Is there any eBay API plugin for that? Thanks. Sam ...

how can I find out the current route in rails?

I need to know the current route in a filter in rails.. how can I find out? I'm doing REST resources, and no named routes ...

rails specify method for redirect_to

During a post for a new model, I am checking for authentication via Authlogic. There is a before_filter on the create request. It is calling require_user. After the user session has been successfully created, the redirect_back_or_default(default) method is called. The problem is, The request needs to be posted to the stored uri. I ha...

Ruby documentation HOWTO?

Ok, so I'm finding it quite difficult to locate documentation for ruby. For instance, I was just trying f = File.open("some-file.txt","w+") and then want to check what methods I have available on f after this. I try out the following, just to see what thing I get back from open ri File.open -> Nothing known about File.open If I bro...

How can I make this massive Ruby if/elsif statement more compact and cleaner?

The following if/elsif statement is clearly a behemoth. The purpose of it is to change the phrasing of some text based on if certain data has been filled in by the user. I feel like there's got to be a better way to do this without taking up 30+ lines of code, but I'm just not sure how since I'm trying to customize the text pretty signif...

removing extensions in subdirectories

I need to remove the extension ".tex": ./1-aoeeu/1.tex ./2-thst/2.tex ./3-oeu/3.tex ./4-uoueou/4.tex ./5-aaa/5.tex ./6-oeua/6.tex ./7-oue/7.tex Please, do it with some tools below: Sed and find Ruby Python My Poor Try: $find . -maxdepth 2 -name "*.tex" -ok mv `sed '[email protected]@@g' {}` {} + ...

Ruby on Rails map.root doesn't seem to be working

I am trying to get the root of my application to route to a default controller. From what I read, this should be possible with something like this at the bottom of my routes.rb file: map.root :controller => 'albums' or perhaps even: map.home '', :controller => 'albums' However, when I try navigating to http://myhost:8000/, I just...

Debugging Ruby/Python/Groovy

I'm rephrasing this question because it was either too uninteresting or too incomprehensible. :) The original question came about because I'm making the transation from Java to Groovy, but the example could apply equally when transitioning to any of the higher-level languages (Ruby, Python, Groovy). Java is easy to debug because there ...

What is a good Code to Test Ratio?

I am using RSpec for writing tests. What do you think, is a good Code to Test Ratio? ...

radio buttons not updates the value

hi, i want to use radio buttons for survey. ex: Best Article Award Tamil Monica Best Article on Travelogue Award Tamil Selvi ... the answers will be the radio button.. am implementing this as follows <%=radio_button(count, :voting, :nominees ) %> <%= response.nomination %> where count is the id of radio button voting -- model...

increase a field value based on the radio button selection

<% count = 1 %> <% for question in @questions % <%=count%>. <%= question.title if question.title%> <% for response in @response %> <% if response.question_id.eql?(question.id) %> <%=radio_button(count, :voting, :count_modification) %> <%= response.nomination %> <% end % <% end % <% count += 1 %> <% end %> Thi...

Debugging an SMTP Timeout Error

I'm working on a Rails project that utilizes Action Mailer to send out mail campaigns. For the moment I have been testing everything with a plain old GMail account. Getting closer to release now and I've decided to switch the smtp server to our local mail server. This is all well and dandy until we attempt to actually send mail. With th...

Using before_filter in application controller and except

I use a before_filter in the application controller. This filter should be used for every controller except two actions in one controller. How can I define this exception? Thanks! ...

What are the pitfalls and solutions when setting up Rails/Mysql on Leopard?

Hi there, I've been going stir crazy trying to install the ruby mysql gem here, and I'm writing here so if anyone else is in this ridiculous situation, they don't have to go through the same pain as me. What are the common gotchas when installing the mysql gem onto a fresh copy of Leopard? In this case, I'm using Leopard - OS 10.5....

Memcached stores data but Rails is not using it.

environment.rb: config.cache_store = :mem_cache_store, '127.0.0.1', { :namespace => RAILS_ENV.to_s } development.rb: config.action_controller.perform_caching = true This is the memcached output when I call the url. get development:views/127.0.0.1:3000/aktionen.xml sending key development:views/127.0.0.1:3000/aktionen.xml END set ...

Get numbers from string

Hi. I got a string: "1|2 3 4 oh 5 oh oh|e eewrewr|7|". I want to get the digits between first pipes (|), returning "2 3 4 5". Can anyone help me with the regular expression to do that? ...

L\ Character Notation?

I get strings over an ODBC connection from a SQL Server 2005 which contain characters beginning with 'L\' followed by the character code. These characters are not displayable in Ruby/Rails but with other Applications which are using the same ODBC connection. I am using the ruby-odbc gem with utf-8. Umlaut characters are displayed correct...

How to convert a Net::HTTP response to a certain encoding in Ruby 1.9.1?

I have a Sinatra application (http://analyzethis.espace-technologies.com) that does the following Retrieve an HTML page (via net/http) Create a Nokogiri document from the response.body Extract some info and send it back in the response. The response should be UTF-8 encoded So I came to the problem while trying to read sites that use...

How can Rails' Activerecord table refer to itself?

Hello, everyone. I have an idea to use Activerecord to implement something strange like the example below: SystemInfo < ActiveRecord::Base belongs_to :SystemInfo end The idea is, System A can contain System B as its child. So I will generate application's skeleton as: script/generate scaffold SystemInfo parent_id:integer name:str...

Skipping chosen types in ruby yaml serialisation

I'm serialising some object using YAML::dump(). Unfortunately that includes some elements that shouldn't be serialised, like locks with waiting threads sometimes. Is there any way to exclude selected types from serialisation, or force them to be serialised as an empty object instead? ...