ruby-on-rails

myapp.com/@username url in rails routes

Hi I have a simple rails question that I am simply unable to figure out. like the title says, I want to get my users controller show page to have the myapp.com/@username url but I don't know how to do this. My knowledge of routes must be fundamentally flawed. my links now usually look like this: <%= link_to "#{@user.username}", :contro...

rake Virtual timer expired

I am using os x 10.6 1.8.6 via rvm rails 2.3.6 I can run rake or script/server I get an error Virtual timer expired I have seen someone else had this issue and seems, the mysql gem needs to be downgraded to 2.7 i have tried to install mysql -v=2.7 i get a different error ERROR: Error installing mysql: ERROR: Failed to build gem n...

Updgrading to rails 3

I just ran $gem upgrade rails It seemed to go smoothly (updated 23 gems, no errors, etc...) when i run $rails -v It tells me I have 2.3.5. What gives? ...

RAILS_ENV vs Rails.env? And Why the values are different?

I have already read this question : http://stackoverflow.com/questions/2715035/rails-env-vs-rails-env I have added rails-dev-boost plugin (http://github.com/thedarkone/rails-dev-boost) and it internally uses Rails.env.development? to check and bypass its scripts if its not development. This is generally okay. But I also use Spork Testu...

Rails - Using mailman to receice emails

Hi, I'm trying to make an application to receive emails using 'mailman' in RubyonRails3. Can somebody help me provide detail guide on it. ...

Can't set session cookie browser for one particular user

Hi, We've got a rails 2.3.10 application running with restful authentication. We have a user who is running Windows XP and Firefox 3.6 / IE9. The user can't seem to get the session cookie (_app_session) to save on the local machine even through the set cookie header includes the _app_session cookie (verified in firebug). Other users, in...

How can I renew access token in Ruby OAuth gem?

Hi, I am trying to renew my access token using Ruby OAuth gem. I wrote my custom method, but it does not work. Has anyone tried renewing the access token using the OAuth gem? If yes, then how? ...

I can't install Phusion Passenger to run Rails

The problem is simple. I use the following command to install Passenger passenger-install-nginx-module When Passenger automatically installs nginx, I can't launch it. nginx -v Returns there's no nginx installed. How can I fix this? ...

Problem with using the REST-ful link_to while using it in a mailer.

I strongly feel its a silly error and I'm somehow not able to see through it. I'm trying to use this piece of code in the view of my mailer. <p><%= link_to 'here', unsubscribe_path(:email => "[email protected]") %></p> And I've defined a named route in my routes file : map.unsubscribe '/unsubscribe', :controller => :users, :action => :unsubscr...

Need to count tag IDs

I need to read the number of times that tag_id shows up in the listings_tags db table. Tags are entered into the system via the Listings form. I have a page that lists just tags. current tag1() tag2() tag3() tag4() Desired tag1(40) tag2(22) tag3(5) tag4(4) code that may be relevant schema create_table "listings_tags", :id ...

How to write integration tests for background workers

I am building something similar to BBC Zeitgeist. Basically it's a series of workers passing jobs to each other. If I'm doing this by hand, here's what I'll do: Setup some parameters Run the workers Start the initial worker Wait for the workers to do their jobs Test the outcome For the background job workers, I'm using Resque. I'...

In Rails, can I check in a view whether the action is to be cached?

Hi, I am using caches_page in controllers, like so: caches_page :index Is there a way I can check in the view files whether the action is to be cached or not? Thanks ...

Rails HABTM association through two join tables

I have the following models: class Friendship < ActiveRecord::Base belongs_to :user belongs_to :friend, :class_name => "User", :foreign_key => :friend_id has_and_belongs_to_many :friend_groups end class FriendGroup < ActiveRecord::Base has_and_belongs_to_many :friendships end How can I declare that FriendGroup has_and_belongs...

paperclip custom :path and :url

Hi, I have some problems trying to custom the :path and :url options for has_attached_file with paperclip: I have a polymorphic class named "Asset" that have : class Asset < ActiveRecord::Base belongs_to :file_owner, :polymorphic => true has_attached_file :picture, :styles => { ...}, :url => "/attachments/user_:use...

Frames in erb Rails

Hi, I need the information to create frames in erb rails. I need to display the links in a frames instead of provide as link to new window. Eg. a href="taxas?[gm]=<%= prefer.genus_name %>&[sp]=<%= prefer.sp_epithet%>" target="new">Link /a This should be modified as frame href="taxas?[gm]=<%= prefer.genus_name %>&[sp]=<%= prefer.s...

What does --pre do in gem install rails --pre ?

What does --pre do in gem install rails --pre ? ...

How to downgrade rails version in Max OS X Snow Leopard?

Hello. I have Mac OS X Snow leopard that has pre-installed Ruby 1.8.7 and Rails 3.0.1 I need to work with Redmine a bit that requires Rails 2.3.5 Is it possible to correctly downgrade my current rails 3.0.1 to rails 2.3.5? ...

Error when trying to start server after upgrading to Rails 3

I've just upgraded to Rails 3, using the instructions from this railscast. When I try to start the server, this is what happens: $ rails s script/rails:6:in `require': no such file to load -- rails/commands (LoadError) from script/rails:6:in `<main>' I can't find this exact error using Google. Anyone know what is causing this? Tha...

how do you stop a mail server / actionmailer?

I just ran a command that's sending out mass emails to everyone. How do I force stop my action mailer? the job was done through delayed_job and I tried rake jobs:clear and script/delayed_job stop ...

How to use a branch in a fork of rails in a project with bundler

I've got a fork of the rails repo on github, in which I've got a branch, based on the rails-2-3-stable branch. I want to develop some changes based on rails 2.3.10 together with my app. We're using bundler, and the app is versioned with SVN. What is the cleanest way to use my branch in the github fork of rails and share this across mach...