Displaying 6 results from an estimated 6 matches for "location_types".
Did you mean:
location_type
2008 Jun 12
1
unidirectional belongs_to polymorphic
The setup:
class Location::Base < ActiveRecord::Base
set_table_name :locations
...
end
class Location::Address < Location::Base
...
end
class Location::Airport < Location::Base
...
end
class Person < ActiveRecord::Base
belongs_to :location, :polymorphic => true, :class_name =>
"Location::Base"
...
end
I want a unidirectional belongs_to relationship. That
2011 Sep 27
0
has_many with :finder_sql returns [nil]?
Is it supposed to do that? I find it very confusing.
AR 3.0.10
class Unit
has_many :units, :finder_sql => proc {
"SELECT * FROM `#{table_name}` WHERE `location_id`=#{id} AND
`location_type`=#{Location::UNIT}" }
end
Both should return []. However...
>> Unit.first.units.find([1000000])
[2011-09-27 10:05:11|main|debug] Unit Load (4.0ms) SELECT `units`.*
FROM `units`
2008 Nov 05
4
select in form - best practice?
Q. What resource do readers recommend for referencing regarding best
practices for form construction in Rails?
I have the following situation: location_type of Locations may have one
of five (5) possible codes. Presently I have these codes listed in a
drop-down select constructed thusly:
<p>
<b>Location type</b><br />
<%= f.select :location_type,
2006 Feb 09
0
pass values with autocomplete textfield
...filter the
autocomplete results by the value of the select.
My view code looks like this:
<%= form_remote_tag :update => "search_results",
:url => { :action => :search } %>
Location: <%= text_field_with_auto_complete :location, :name %>
<%= select :loc, :type, @location_types.map { |l| [l.location_type] } %>
<%= submit_tag "Search", :class => "search_btn" %>
<%= end_form_tag %>
Is this possible?
Thanks,
Chris
2014 Feb 06
0
Array Confusion
I have the following instruction that returns an array that I'm quite confused about. I can't even read it. Can someone shed some light as to how to reach into this array of hashes (that's what I can see) to get the location lat and lon?
res = Geocoder.search(addy1)
This is the res:
[#<Geocoder::Result::Google:0x007fb46c345e18
2007 Nov 07
5
Unexplainable failure...at least for me
I have an address model with country_id and province_id fields
There is also a full_address method that returns an address that is in a
format that the google maps api will be able to return a long-lat
coords.
Within the full_address method there is a call to obtain the
province/state and country name.
---------
def full_address
...
full_address = [city, self.province.name,