search for: dudebot

Displaying 8 results from an estimated 8 matches for "dudebot".

Did you mean: diderot
2009 Aug 26
5
Noob DRY method question
Hi Gurus, I''m learning the Rails framework, and I have this exact block of html/javascript in two places in an if/else construct in application.html.erb: <body onload="Modalbox.show(''<div class=\''warning\''> <p> <center> <%= flash[ :notice ] %> </center> </p> <p> <center> <input
2009 Sep 24
8
Drop down list ?
Hi Gurus, I''m trying to tackle a drop down list. I have category and item dbs, and they''re wired up with category has_many :items and item belongs_to :category, and an item has a category_id. I have this code in my new/edit.html.erb for item: <%= f.collection_select :category_id, Category.find_main, :id, :header, {}, :multiple => false %> And a pretty drop down list
2009 Sep 25
12
uniqueness validation perplexity
I want to write a validate routine to check to enforce that a position must be unique in a category. (In another category, it doesn''t have to and shouldn''t need to be unique.) I write this code which works happily for new items: def position_in_category_not_unique @items = Item.find( :all, :conditions => [ "category_id = ? AND position = ?", category_id,
2009 Sep 24
2
Calling ActionView from uninheriting class
Hi Gurus, I have a class, specified in models cart.rb, which doesn''t inherit from anything--it''s just a container class Cart ... I just discovered I can''t call number_to_currency in that class. Any idea how to "include" it in my code? I tried ActionView.number_to_currency without luck. I could kill a few lines of non-DRY regexp code in cart.rb if I could
2010 Mar 24
3
More elegant solution for "missing" has-many through ids?
I have LabGroup and LabDesc which have many through LabDescGroup. I''d like to identify LabDescs which don''t have a LabGroup. This works: x = [] LabDescGroup.find( :all, :select => ''DISTINCT lab_desc_id'' ).each{ |c| x << c.lab_desc_id } y = [] LabDesc.find( :all, :select => ''id'' ).each{ |c| y << c.id } notfound = x - y But
2010 Apr 01
6
Rails model design visualization
I''m a fairly visual person, and I have a piece of paper with many boxes and arrows with labels like "has many" and "belongs to" for my database models. It''s messy, but it works. What I keep looking for--weeks, actually, I''m certain it''s out there, but I haven''t hit on the right set of Google query terms :)--is something that will
2010 Jan 21
2
will_paginate ?
Does anyone have experience with will_paginate? I''m trying to use it with acts_as_ferret. routes.rb ... map.search ''/search'', :controller => ''notes'', :action => ''search'' notes.rb ... acts_as_ferret :fields => [ ''body'' ] notes_controller.rb ... def search if params[ :query ] @query = params[
2010 Mar 23
0
Frozen hash problem
I''d like to delete some records before saving them. I ran this experiment: before_save :prune_lab_datas def prune_lab_datas lab_datas.each do |lab_data| lab_data.destroy end raise lab_datas.to_yaml end But nothing seems to be deleted in the hash: --- - &id001 !ruby/object:LabData attributes: created_at: 2010-03-21 22:16:06 unit_id: "3"