ruby-on-rails

facebook iframe application with ruby and the new open graph api

i am trying to get an iframe facebook application running with ruby. unfortunately the facebooker gem seems to be broken and even the developer of facebooker suggests using the facebooker2 gem and some workarounds. see http://www.elevatedcode.com/articles/2010/05/12/facebook-iframe-applications-and-the-new-open-graph-api/#extended is t...

Ruby on Rails: Global Helper method for all controllers

How do I set up a method that I want accessible from all controllers? Sticking the method in application_helper just makes it available to the views ...

Rails query to find other likes based on category

I need to do something like the following: Find other categories people like based on the categories you like. I have a likes table, which is joined to users and categories. I need to do an efficient query to find out what other categories people who liked a given category also like. Any thoughts on this would be appreciated. Thanks...

How test a send_data method in rails?

How I can test a send_data method? ...

Test for absence of an input tag's value attribute

How can I confirm the absence of a HTML attribute in a Rails RSpec test? I can verify that an input tag has a value attribute and that it is an empty string like so: response.should have_tag("input[name=?][value=?]", "user[password]", "") response.should have_tag("input[name=?][value=?]", "user[password_confirmation]", "") But what I...

Ruby on Rails - can't access datetime model object

I've created a model that has 3 string columns and a datetime. Everything is running in SQLite3 and I can view the records in my table just fine using Lita. I'm trying to display the values in a page (index action) using code like this: <% @details.each do |lifeCycle| %> <%= debug(lifeCycle)%> ...

Rails Testing Question

Hi, I am trying to test a functionality, which inserts few details into the DB. In the test.log, it shows the insert command that is generated and also the log messages that I have placed to show the progress and everything seems to be working fine except the actual data is not getting inserted into the DB. I am checking whether data ...

Using RVM with GVim (Cream): rvm command not found.

I am trying to move to GVim(cream) as my primary editor on Ubuntu. I am using the wonderful rails.vim, however I also am using RVM. Rvm works fine when doing things in a shell, and the ruby version I would like to use in rails.vim is the version set as default (but not the system version). When I try to run things like :Rgenerate migr...

ruby-on-rails: string, decimal or float for price field?

i've got a price field/column and i wonder should the rails datatype be string, decimal or float? eg. 15.50 USD. thanks ...

Rails subscription limitations

I have an application with set limits on subscription attributes i/e a user can have five projects for subscription A but have ten for subscription B At present I run a check on there current usage when linking to the create action and if they are over there limit I do not display the link to create a new project. On the view (for the n...

Change request environment variables in Rails integration testing

I have written a functional test that changes some of the request object's environment variables to simulate a user has logged in. require 'test_helper' class BeesControllerTest < ActionController::TestCase # See that the index page gets called correctly. def test_get_index @request.env['HTTPS'] = "on" @request.env['SERVER...

Complex Forms in rails (has_and_belongs_to_many)

Hello all - Right now, I'm in the middle of actually building a Project Management application, and I'm kind-of stuck on the way i should build this form. At the moment of adding a project I would like to select the clients that would be included in the project. Here's the code to a few things of interest: Project Model Project Migrati...

rake jobs:work working fine. problem with script/delayed_job start.

I am calling function with LoadData.send_later(:test). LoadData is my class and test is my method. It's working fine while i am running rake jobs:work. But when i am running script/delayed_job start or run that time delayed_job.log shows error like TEastern Daylight Time: *** Starting job worker delayed_job host:KShah pid:5968 TEaste...

cattr_accessor not working (outside rails) when active_support is required?

Hi guys, I'm not familiar with active_support, so bear with me! Fox's library allows searching via google's APIs, but it requires active support. i can't seem to get it working though! Any ideas? require 'rubygems' require 'active_support' require 'google_search' p GoogleSearch.web :q => "Hello World!" Gives me: NoMethodError: unde...

Ruby on Rails controller-view refactoring

Hello, In my app I am using the ym4r-gm plugin, which allows you to play with the Google Maps API... I put the map "setup" in the controller: @map = GMap.new("div_map") @map.control_init(:large_map => true, :map_type => true) @map.center_zoom_init([47.0, 26.0], 7) ... And only render @map in the view. So my first question is whether ...

Running migration on server when deploying with capistrano

Hi, I'm trying to deploy my rails application with capistrano, but I'm having some trouble running my migrations. In my development environment I just use sqlite as my database, but on my production server I use MySQL. The problem is that I want the migrations to run from my server and not my local machine, as I am not able to connect t...

What does the option --template in "rails" command?

$rails --help ... Options: ... -m, [--template=TEMPLATE] # Path to an application template #(can be a filesystem path or URL). What does this option mean? ...

sudo gem install rails- this doesn't give me a rails command for bash

I'm on Ubuntu. I type in sudo gem install rails. This works fine, installs railes and 7 other gems fine. Yet $ rails blog is saying this: The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails ...

Facebook Graph API with Rails and Authlogic - preferred methodology?

There are lots of Facebook + Rails solutions, most notably Facebooker, but this and many others are not compatible with Rails 3. I'm currently using Authlogic for authentication with my app, and I want to give users the option of Facebook to sign in. I want to find the best way to have FB and Authlogic go together; right now I'm just wri...

Active Mailer doesn't have the application helpers when used with delayed_job v.2

So if I try sending an email with action mailer directly, I can use all application helpers like url_for, content_for etc, but when I try to do the exact same action [sending email] with delayed_job [send_later] I getting a delayed job fail, of undefined function content_for etc, so it is like no helpers are loaded in my ActionMailer. I ...