I'm not even sure how this broke. And I don't really know what the error means either. It was working previously.
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.to_sym
Extracted source (around line #3):
1: <div id="probes">
2: <h1>Edit Probes</h1>
3: <% form_for @probe do |f| %>...
I had to migrate from a mySql based ruby on rails app to using postgresql. No problems but one so far, and I don't know how to solve it.
The migration of data brought ids along with it, and postgresql is now having problems with existing ids: it's not clear to me where it gets the value that it uses to determine the base for nextval: i...
I have a method that needs to loop through a hash and check if each key exists in a models table, otherwise it will delete the key/value.
for example
number_hash = { :one => "one", :two => "two" }
and the Number table only has a :one column so :two will be deleted.
How do I check if a model has an attribute or not?
...
I'm wondering what the technologies and best practices are behind real time collaboration in web interfaces.
An example of this is of course Google Wave. Another is PivotalTracker.com.
I'm particularly interested in any work (frameworks, plugins, etc) people are doing with Ruby on Rails here.
I imagine it would have to use Javascript...
I'm trying to retrieve JSON data from a remote site with Rails/Prototype.
I've found that there's a branch of Prototype that has an Ajax.JSONRequest() function. I can't get this to work.
jQuery has a $.getJSON() function, but I'm using some Prototype functions and I'd rather not switch to jQuery or use no conflict mode.
What am I miss...
I was previously using has_and_belongs_to_many, and have converted to has_many :through. Here's how it looks for a list of games that can have many users playing. With this, I can do game.users and user.games....:
class Game < ActiveRecord::Base
has_many :game_users, :dependent => :destroy
has_many :users, :through => :game_users, :...
I'm trying to edit a form, the route is controller/id/action for edit so for example
people/124321/edit
I'm trying to make this form submit to the update action using this code:
<% form_for :probe, @probe, :action => "update" do |f| %>
...
...
...
<%= submit_tag 'Submit' %>
<% end %>
When I click submit, it gives me ...
I've got a named scope like this:
named_scope :by_items, lambda |*items| {
:joins => :items,
:conditions => ["items.id in (?)", items.map(&::id)]
}
What's the "*item" mean? When I call it with "Item.find(:first, ...)" it works fine. If I try to call using a collection, "Item.find(:all, ...)" it fails.
From a different SO questi...
I currently have a rollover button implemented in rails as follows:
<%= image_tag("header/home_but.gif", :mouseover => "header/home_over.gif") %>
How can I preload/cache the mouseover image (home_over.gif) so there is no delay when the user moves their mouse over the image? Thanx.
...
This is really racking my brain, but maybe I'm trying to hard.
I'm passing a param via a URL (example.com?debug=true)
So I basically want to say:
if params[:debug] == true
do xyz
else
do abc
end
But for whatever reason that if statement just isn't doing like it seems like it should.
Is there a better way to do that if/else statem...
In my application, I have the need to allow blocks to be defined and called within the scope of a class, using instance_exec (via Rails 2.3.2). However, some of these blocks need to return early in some situations, which is causing me a problem.
My application was built using ruby 1.8.6, but I need to get it running on 1.8.7 as well. It...
Hi,
i have following code
class Category < ActiveRecord::Base
has_many :categorizations
has_many :posts, :through => :categorizations
end
class Post < ActiveRecord::Base
has_many :categorizations
has_many :categories, :through => :categorizations
end
class Categorization < ActiveRecord::Base
belongs_to :post
belongs_to :ca...
If I write this, everything works fine:
class A < ActiveRecord::Base
acts_as_taggable
end
But if I take acts_as_taggable and put it into a module that class A includes, I get an error:
module B
def self.included(base)
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
module ClassMethods...
my error, my usage was based on this link (form builder tab): http://electronicholas.com/calendar
ArgumentError in Sales#new
Showing app/views/sales/new.html.erb where line #14 raised:
wrong number of arguments (5 for 4)
Extracted source (around line #14):
11: <%= f.text_area :description %><br />
12: <br />
13: <%= f.label :s...
I have a form which contains rows like this one. I need to be able to call a method on a controller using ajax/jquery when the user clicks the radio button. The method would change the underlying model, on return it would show a message in the flash on the client.
<tr>
<td><%= radio_button_tag 'primary', feature_photo.id %></td>
<t...
Are there any performance concerns related to the use of helpers like url_for and link_to in a Ruby on Rails application?
...
I am trying to synchronize members in the db with an external source
My plan was to use the array collection in the active record class and on each update for a member found in the external source, I would remove that member entry in the array(if it exists) then after I am done iterating the external source I would iterate and operate o...
Hi guys, this is a really stupid question but I have a deadline and I'm very nervous and I've tried everything. In fact it even worked for a second but I must have broken something.
I have a default featured item that I want to be overridden any time I try to feature another item. I had it give an error before but I don't want it to err...
Rails has very nice way to generate test data with factoryGirl/Machinist +Shoulda .
from factorygirl site
"Factory Girl provides a framework and DSL for defining and using factories to create data records for ruby test suites. The goal is to be less error-prone, more explicit, and all-around easier to work with than Rails’ fixtures."
...
Because RoR does not offer a validate_on_destroy, I am essentially implementing one by using the before_destroy callback.
Using before_destory works and prevents a project that has had effort_logged? from being deleted. The below implementation does not work because when no has been logged I want to delete the project and all of its dep...