Displaying 7 results from an estimated 7 matches for "area_id".
2006 Aug 19
3
Special ruby language for describing sql conditions
...ease, so does the uglyness.
So instead of passing a hash, I thought you could specify the conditions
directly in code.
I hacked together some example code which actually turned out to work.
The result is concise and pretty beutiful.
def search(params)
Ad.find(:all) do |conditions|
conditions.area_id = params[:area_id] if params[:area_id] &&
params[:area_id].to_i > 0
conditions.kind = params[:kind] if params[:kind]
conditions.selling = params[:selling] || 1
conditions.approved > 1
conditions.year.include?(2004,2005)
conditions.or do |conditions|
if params[:...
2006 Aug 25
4
using conditions
Hello guys,
I''m pretty new to using AAF and am having a slight problem with using a
condition. I have the following code
@results = SupplierProduct.find_by_contents(params[:search], :conditions
=> [''area_id = ?'', @area])
and it seems the condition isn''t being applied. Does anyone have any
pointers?
Cheers,
Alastair
--
Posted via http://www.ruby-forum.com/.
2006 Aug 25
7
acts_as_ferret with conditions
Hello guys,
Having a slight problem with acts_as_ferret, specifically using a
condition. I have the following code
@results = SupplierProduct.find_by_contents(params
[:search], :conditions => [''area_id = ?'', @area])
and it seems the condition isn''t being applied. Does anyone have any
pointers?
Cheers,
Alastair
------
Alastair Moore
Standards compliant web development with Ruby On Rails, PHP and ASP
www.kozmo.co.uk
07738 399038
--~--~---------~--~----~------------~-----...
2006 Aug 10
5
RJS in Internet Explorer to update a list box
...ow) on Firefox, but on Internet
Explorer it clears the list box (instead of filling it) and Netscape
shows all the counties cramped together on one <option> instead of
multiple options.
This is the relevant code from the form:
<select id="area_county_id"
name="address[area_id]"><option value="0">Select a
state</option></select>
<select id="address_area_id"
name="address[area_id]"><option value="0">Select a
county</option></select>
<%= observe_field "county_state_id"...
2007 Jun 22
0
some skill problem with Updater
...x.Updater(''person_area_places_box'', ''/person/
area_places_select'', {asynchronous:true, evalScripts:true,
onComplete:function(request){new
Effect.Shake(''person_area_places_box'')}, parameters:''id=''+value})"
name="person[area_id]" id="person_area_id">
...
I hope the Effect.Shake could get the id same as set for
Ajax.Updater, here is ''''person_area_places_box".
does any one get any idea to do that such as like :
Effect.Shake(request.caller.container.id)
--~--~---------~--~----~---...
2013 May 09
0
loading custom type
...uppet apply''.
I found that I can do this:
service = Puppet::Type.type(:service).new(:name=>''qpidd'')
service.provider.start
I would like to be able to do the same thing with my custom types, e.g.
broker = Puppet::Type.type(:broker).new(:service_name=>"qpidd_#{area_id}",
:url=>@broker_url)
or
exch = Puppet::Type.type(:exchange).new(:name=>''test'')
but in both cases, I get:
undefined method `new'' for nil:NilClass (NoMethodError)
so I checked the Puppet::MetaType::Manager @types, and my custom type
doesn''t show...
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
...a bit like:
class Survey
has_many :areas
end
class Area
belongs_to :survey
has_many :questions, :order => ''position''
validates_uniqueness_of :position, :scope => : survey_id
end
class Question
belongs_to :area
validates_uniqueness_of :position, :scope => : area_id
end
So to get the questions on a survey, sorted by the ''survey_position''
attribute I have to add a foreign key to the question, so that I can
pass the survey_id to the :scope argument on validates_uniquess_of. So,
I have to add this stuff to Survey and Question classes:
class Su...