ruby-on-rails

[Rails] OAuth with Digg API

I'm attempting to get Rails to play nice with the Digg API's OAuth. I'm using the oauth gem (ruby one, not the rails one). My code looks approximately like this: @consumer = OAuth::Consumer.new(API_KEY, API_SECRET, :scheme => :header, :http_method => :post, :oauth_callback => "http://locahost:3000", :request_token_url => 'http:...

I am unable to install rails through gem on windows 7, how do i install it?

I am following these instructions provided here. But i am unable to do the second step, that is installing rails with gem. i use the code that they provide and my cmd does nothing. It just stays there without doing anything. ...

Rails acts_as_taggable_on grouped alphabetically?

Having sorted the tag_counts hash via the following code: sorted_tags = Contact.tag_counts.sort{ |x,y| x.name.downcase <=> y.name.downcase } what is the easiest/most efficient way to display the tags in my view grouped by letters? i.e A - "Alpha", "Apple", "Aza" B - "Beta", "Bonkers" . . . Z - "Zeta", "Zimmer" Any ideas? ...

help with sending mail in rails, bad tutorial

I'm trying to follow this tutorial to send mail through rails: http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-send-emails.htm Sendmail wasn't working on my machine, but I got it working when I deployed it. The problem I'm having is that the @email variables and such don't show up in the mail when it's sent. What is wrong? ...

how to internatianalize the ruby on rails site

We have the rails app, content served from the database. Now we need to translate that to multiple languages. What is the best way to the internalization of the ruby on rails application? ...

Rails - execute multiple queries in a single connection

How do I issue multiple SQL queries in a single database connection in Rails? My problem is, I have multiple records(about 200 or more records) to be checked with the database table's existing records(I am checking composite primary key values) I could use ActiveRecord's exists? method in a single transaction block. But I don't know whe...

Arabic full text search in RoR

I am trying to add full text search capabilities to my RoR app, but facing some issues when it comes to Arabic. AFAIK, there aren't many search engines out there that support arabic stemming, morphology and other advanced full text search. The only thing I found was Lucene with the AraMorph tokenizer. The acts_as_solr plugin (solr is ba...

How can this C and PHP programmer learn Ruby and Rails?

I came from a C, php and bash background, it was easy to learn because they all have the same C structure, which I can associate with what I already know. Then 2 years ago I learned Python and I learned it quite well, Python is easier for me to learn than Ruby. Then since last year, I was trying to learn Ruby, then Rails, and I admit, u...

how to use either email or login in Authlogic

Hi, I'm using Authlogic with my Ruby on Rails App. I would like user to enter either user name or password in one field to authenticate. How do I do this with Authlogic? I know I can switch to using email: acts_as_authentic do |c| c.login_field = :email end I was sure if I can tell Authlogic to use either. Cheers, Tam ...

Multi Select menus and Virtual Attributes

I have periods table that has start_at:datetime end_at:datetime . Because each period begins and end at the same date, I want to separate the in three fields instead of two. field 1: the date field 2: the time "00:00" of start field 3: the time "00:00" of end I started and done this. But unfortunately, I faced a problem. So please tak...

Changing the default ActiveRecord id from 0 to 1000000

Hello there, I'd like to change the minimum for the id of created objects from 1 to 1000. So when I create in rails my first model object it gets the ID 1000 and not 1. Is there a way to set this in the schema/migration files? ...

Strange error coming from ActiveRecord (probably)

My development environment: Ubuntu 9 Ruby 1.9.1/1.8.7 (rvm) Rails 2.3.5 Mysql 5.0 Apache Passenger Below is the part of the program flow to represent the issue. Request comes: #action def create begin @report = Report.new(params[:report]) ... rescue LocationNotFound => e ... end end Report constructor: class ...

RJS code returned doesn't execute

I am using jQuery with rails. I am trying to make a PUT request to update a task. The call is made successfully. However, the javascript code returned does not execute. The code is returned alright but it just does not execute. Here is the jQuery put request i am making. $("#droppable_<%= bin.id -%>").droppable({ drop: function(e...

Is it possible to call rails model methods from rack middelware?

def inside_rack_middelware MyModel.update_attributes(:ip => request.ip) redirect somewhere else end is that possible? ...

General Patterns for Managing Random Configuration Variables

Being the one always trying to boil things down to common patterns, I'm having a hard time figuring out the best and/or recommended ways of managing all those random properties throughout an application. I am looking for some SO wisdom. What are the random properties I'm talking about? Here's a small list: favicon alt text for rando...

Why does Rails with Passenger/nginx only works in development mode? No logs available

Hey folks, I have a serious problem with one of our webservers... after having an internal alpha-testing with a mongrel/haproxy-cluster that worked well, we wanted to use nginx with passenger for our first production server (customers will access this server). However, I can only run the rails app via development mode with passenger/ng...

scroller up and scroller endless in ruby on rails

scroller up and scroller endless in ruby on rails ...

Ruby on Rails Invalid Authenticity Token when using IE

Hi, well for some strange reason IE gives me and InvalidAuthenticityToken error almost every time a POST query is used. Seems to be that IE does not like the "/" and "=" characters sometimes found in authenticity_token. So I wondered if anyone has actually found a solution to this? More strange is that no other browser seems to behave t...

In a rails app, should e-mail be sent as a background job or synchronously?

We are getting close to releasing our new rails app and so far interest seems very strong we are a little worried about where bottle necks will be. One seems to be system e-mails on signup and in other situations. Is this correct? Should individual e-mails to users be sent asynchronously in the background? If so, what would be the be...

Spaghetti Rails Routing and Invitation Coding Bolognese

I'm not really sure if there is a single problem here or I have approached this in the wrong way, but any suggestions would be greatly appreciated! In the application when a user signs up they get privileges and their page gets set up, they can then invite colleagues by email. The email has an activation code tagged on the end. An exam...