ruby-on-rails

Why are the gems not showing up?

So this happens to me regularly, where i have gems that are installed but for some reason my rails app is not finding it...here is my example my config/environment.rb config.gem "whenever" my install sudo gem install whenever Password: Successfully installed whenever-0.6.2 1 gem installed gem list | grep when whenever (0.6.2) scr...

updating countdown timers

I'm starting to build a script for a Penny Auction site like swoopo.com What framework should I use? Whats the best way to keep the timers updated without using too much bandwidth? This all started when I started looking at all the junk thats currently out there. Most are using PHP and javascript and I feel there is a much better solut...

Model traversal in rails: from child to sibling's child

Hi, I have the following model: class Advisor < ActiveRecord::Base belongs_to :course end class Course < ActiveRecord::Base has_many :advisors has_many :sessions has_many :materials, :through=>:sessions end class Session < ActiveRecord::Base belongs_to :course has_many :materials end class Material < ActiveRecord::Base ...

rails button_to is not setting the class correctly

My code: <%= button_to 'Login', {:type => 'submit', :class => 'submit'} , {}%> I want to end up with this: <input type='submit' value='submit' class=submit/> but what I'm getting is: <input type=submit value=submit/> how to set the class? ...

I created a signin action, and haven't implement so I just want to redirect to login action.

I have an action named 'login' that shows the login form. The form posts to the 'signin' action. I haven't implemented the authentication logic yet, so I tried this: def signin redirect_to login end So when the login form posts, it just redirects back to the login page again. Cannot redirect to nil! but its not working, wh...

why can't I get my deployed Rails app to run in dev mode locally?

I'm running Rails 2.3.2 on Ubuntu with passenger. In /config/environment.rb, I've set ENV['RAILS_ENV'] ||= development In the Apache config file, I've set <VirtualHost *:80> ServerName localhost DocumentRoot /root/webapps/myapp/public RailsEnv development <Directory /root/webapps/myapp/public> AllowOverride all Option...

How my rails app can handle twitter echo & verify_credentials.json?

How my rails app can handle the incoming headers of a request like: curl -v -H 'X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json' -H 'X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/", oauth_consumer_key="yTrEIQH6jhtmLUypg8T5", oauth_signature_method="HMAC-SHA1", oauth_to...

rails3: rake task failing because blank? method cannot be found

Hi there, I have a rake task that I created to populate my database with fake data. One of my models has a before_validation callback method which uses the blank? method. When I run my rake task, the task is aborted with the following message: rake aborted! undefined method `blank' for #<BigDecimal:101848c10,'0.35E2',9(18)> ...

convert rails app from 3.0 to 2.3.5

I have a rails 3 application on localhost, but my host (dreamhost) uses 2.3.5. Are there any techniques to downgrade my application? I've tried installing rails 3 locally, but there is a conflict with rake. And simply trying to run my application results in an "uninitialized constant Bundler" error. I'd rather not re-write it from sc...

Rails booleans bug ?

I have a rather misterious problem dealing with booleans in Rails, here is how to reproduce: rails new boolean_bug rails generate model User verified:boolean With this you should have an empty project with the User model. 3 Inside boolean_bug/app/models/user.rb ' class User < ActiveRecord::Base before_save :set_false attr_access...

How can I specifiy what access I need from my user's Facebook accounts when using OmniAuth?

When you use OmniAuth to login to a web app through Facebook, these are the permissions the webapp has: Access my basic information Includes name, profile picture, gender, networks, user ID, list of friends, and any other information I've shared with everyone. Send me email WebApp may email me directly at [email protected] Access my da...

user , comment association not working, comment.user.email returns No method error?

I have the following models with associations as given below:- class Comment < ActiveRecord::Base belongs_to :post belongs_to :user end class Post < ActiveRecord::Base belongs_to :user has_many :comments end class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable,...

Rails 3 and mysql master-slave replications

Hi! Want to set up mysql master-slave replications in rails app. Are there plugins/db adapters available for Rails 3? Does the Masochism plugin work properly with rails 3? ...

Trying to upgrade from Rails 2.3.5 to 3.0.1 on Heroku, but Heroku still thinks I'm using 2.3.5

I was previously using Ruby 1.8.7 & Rails 2.3.5 on Heroku. I upgraded my development environment to Ruby 1.9.2 and Rails 3.0.1 using the instructions this railscast. RVM is used, so the system versions of Ruby and Rails are still 1.8.7 & Rails 2.3.5 respectively, but I have an RVM environment with 1.9.2 and 3.0.1, which I now use. I'm...

break down a complex search query in Rails 3

I have a controller which has a lot of options being sent to it via a form and I'm wondering how best to separate them out as they are not all being used simultaneously. Ie sometimes no, tags, sometimes no price specified. For prices I have a default price set so I can work around with it always being there, but the tags either need to...

Rails 3: SMTP Settings for Google Apps / Heroku

Here are my smtp settings for Google Apps in setup_mail.rb. :address => "smtp.gmail.com", :port => 587, :domain => 'mysite.co', :user_name => '[email protected]', :password => 'password', :authentication => 'plain', ...

Can a mobile mime type fall back to "html" in Rails?

I'm using this code (taken from here) in ApplicationController to detect iPhone, iPod Touch and iPad requests: before_filter :detect_mobile_request, :detect_tablet_request protected def detect_mobile_request request.format = :mobile if mobile_request? end def mobile_request? #request.subdomains.first == 'm' request.user_agent ...

Has anyone used omniauth with rails 2.3.8?

Hello All, I am new to Rails and I am trying to use omniauth with rails 2.3.8. I couldn't find any tutorial for this version of rails so I referred to http://blog.railsrumble.com/blog/2010/10/08/intridea-omniauth. I added the initializer as follows: omniauth.rb OmniAuth::Strategies::Twitter = { :consumer_key => 'xxxxxx', ...

App crashed because of syntax error in an helper utf-8 encoded

Dear all. I'm using heroku to deploy my app (rails 3). Ok so I do the usual, which is a git commit, a git push heroku master => deployment is ok, gems are installed, etc... When running my app in the web browser, I get an heroku error : app crashed. In the ouput of heroku logs, this got my attention : ==> dyno-2625316.log (crash) <== ...

does rails have a 'response.write', want to do quick output from an action

From within an action (not the view), I want to output some quick debug code. Does rails have a method for this? in asp.net I would do: Response.Write("hello"); ...