ruby-on-rails

How to debug an wrong number of arguments (1 for 0) in Rails error?

Hi, I was trying to do some refactoring and messed things up but now don't know where or how to debug because it's not clear where the problem lies. Some suggestions on how to dig into the error and code would be helpful...thanks! http://gist.github.com/474290 ...

Safari/Chrome does not understand jQuery focus/blur on check boxes..

Here's my javascript: $(".more_info").hide(); $(".checkbox.has_info, .has_info").focus(function(){ $(this).parent().next().next().show("fast"); }); $(".checkbox.has_info, .has_info").blur(function(){ $(this).parent().next().next().hide("fast"); }); Note, that this works perfectly in Firefox/ IE7, IE8. So far I have discovered th...

How to find all items not related to another model - Rails 3

I have a fairly complicated lookup i'm trying to do in Rails and I'm not entirely sure how hoping someone can help. I have two models, User and Place. A user is related to Place twice. Once for visited_places and once for planned_places. Its a many to many relationship but using has_many :through. Here's the relationship from User. ...

Strange Behavour in Rails 2.3.8

Hello everyone :) I have some problem - when i enter some custom page all is okay, but if i try to push reload buttom - rendering is fail. so, this is log after FIRST PAGE ENTER: Processing WidgetsController#index (for 127.0.0.1 at 2010-07-13 23:27:26) [GET] Rendering template within layouts/widgets Rendering widgets/index Widge...

How can I remove callbacks inserted by vendor code?

A gem I am using inserts an after_save callback that I would like to remove. It seems to me it would be cleaner to delete a symbol from an array than to fix the problem with a monkeypatch. How can I access the array of callbacks? ...

authlogic flash[:notice] does not show up in cucumber webrat step

Hi, I am running BDD steps with cucumber to implement my autlogic login behavior. Scenario: log in Given a registered user: "[email protected]" with password: "p@ssword" exists And I am on the homepage When I follow "Log in" And I fill in "Username" with "[email protected]" And I fill in "Password" with "p@ssword" And I open the page And I pre...

Webrat / Cucumber Matcher - Testing content match with links

Currently I have a like/dislike voting functionality that outputs in the following format: like (#) dislike (#) Where like and dislike are clickable links that update the total count of like/dislike votes (represented by (#)) I am writing a cucumber test to check the like/dislike counts are correct. I'd like to check ... Then I sh...

RoutingError on Ruby Rails?

Hey everyone, thanks for reading this. Ihave the next issue: When I call my "New" template (generated by scaffold) I got the next error: <h1>ActionController::RoutingError in Flujos_de_trabajo#new</h1> Showing app/views/flujos_de_trabajo/new.html.erb where line #3 raised: flujos_de_trabajo_url failed to generate from {:controller=>"f...

How do i change Rails routing from controller/:id to controller/:name in Rails 3?

Hi! Just as the topic say. I want to change the default controller/:id routing to controller/:name instead in Rails 3. In Rails 2 you used named routing with something like this: config/routes.rb map.location 'location/:name', :controller => 'your_controller', :action => 'your_action' alternate named route map.location 'goto/:na...

Ruby on Rails: How can I use a redirect_to in a link_to?

I want to redirect to a certain page after an action (handled by a gem) is finished. ...

Rails3 ":popup has been deprecated"

EDIT: I have accidentally awarded a bounty of 500 points for this question - please do not answer it as I did this without realising what was going on - yes I'm an idiot In rails 2.3.x, the following code would open a link in a popup window: = link_to "resource", resource_path(resource), :popup => true But in Rails 3 I get the error ...

Import - csv to activerecord

I'm writing an import routine that will allow a user to upload a CSV file to load their database. Each row of the CSV corresponds to a model. I'm using FasterCSV to read the file and split the data into individual models, which is working great. I'm just having trouble deciding on the best approach to handle errors. Right now I have t...

Rails: calling yield in a partial template?

I see this sometimes in a partial erb template: <%= yield :someval %> Other times there is no yield at all. What's the advantage of calling yield in a partial? ...

Solution for comments for a Rails application

I'm introducing comments into a Rails application, and, being exceptionally lazy, I'm looking for a plugin to do it for me. I came across acts-as-commentable, but I didn't find much else. Acts-as-commentable seems fine, but it doesn't have support for threading. Of course, it wouldn't be too hard just to home-brew the entire thing, but ...

How To Get Additional Attributes From Has Many Through

I am using Rails 3 beta 4. I have the following models: class Player < ActiveRecord::Base has_many :players_items, :dependent => :destroy has_many :items, :through => :players_items end class PlayersItem < ActiveRecord::Base belongs_to :player belongs_to :item end class Item < ActiveRecord::Base has_many :players_items, :d...

Ruby on Rails: How do you seed the *_type column in polymorphic models?

I have a lot of data that I'm trying to seed into a polymorphic model in Rails 2.3.8. The association for all of the data is with the County model. The data looks like: data = Datum.create([ ... { :value => '14389', :value_type => County, :value_id =>'3103'}, { :value => '59013', :value_type => County, :value_id =>'3105'}, { :va...

rails rolling back migration permanently then branching

This is a rails question about migration versions So i have a few migrations already existing. i.e. in my db/migrate/ folder i have some files like this: 1_add_products.rb 2_add_customers.rb 3_add_addresses.rb 4_add_tags.rb and i've ran "rake db:migrate" so the current version is 4. I want to go back to version 2 permanently and sta...

Ruby on Rails and Cocoa - POST puts values into DB as NULL

Hello, I am trying to send a POST request to my Ruby on Rails local server. Unfortunately, at first it wouldn't let me POST because of protect_from_forgery, so I ended up setting it to false in development and production. Basically, my issue is that I'll send the POST request from my Cocoa app with all of the wanted params, and the Ruby...

Is it better to learn ruby before learning rails?

Possible Duplicates: Do I need to know Ruby in order to learn Ruby on Rails? Should I start with Ruby or Ruby On Rails? I'm going to start playing with ruby, is it better to learn the ruby language alone or at the same time as learning rails? ...

How to change the name of a database model and table in Rails?

Lots out there about changing model names only or mapping new models to existing tables, but nothing about renaming both at the same time. For now, I'm starting with the DB table and working my way out with Find/Replace in my code, but I'm surprised there isn't something better or at least someone who's tried it and written about it. ...