Displaying 5 results from an estimated 5 matches for "craign".
Did you mean:
craig
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 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 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[
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,