relations = sql_find_relations_in_area_and_ways(xmin, ymin, xmax, ymax, ways.collect {|x| x[0]})
else
# find the way ids in an area
- nodes_in_area = Node.find_by_area(ymin, xmin, ymax, xmax, :conditions => ["current_nodes.visible = ?", true], :include => :ways)
+ nodes_in_area = Node.bbox(ymin, xmin, ymax, xmax).visible.includes(:ways)
ways = nodes_in_area.inject([]) { |sum, node|
visible_ways = node.ways.select { |w| w.visible? }
sum + visible_ways.collect { |w| [w.id,w.version] }
points = nodes_not_used_in_area.collect { |n| [n.id, n.lon, n.lat, n.tags, n.version] }.uniq
# find the relations used by those nodes and ways
- relations = Relation.find_for_nodes(nodes_in_area.collect { |n| n.id }, :conditions => {:visible => true}) +
- Relation.find_for_ways(ways.collect { |w| w[0] }, :conditions => {:visible => true})
+ relations = Relation.nodes(nodes_in_area.collect { |n| n.id }).visible +
+ Relation.ways(ways.collect { |w| w[0] }).visible
relations = relations.collect { |relation| [relation.id,relation.version] }.uniq
end
# see /config/application.yml
check_boundaries(xmin, ymin, xmax, ymax)
- nodes_in_area = Node.find_by_area(ymin, xmin, ymax, xmax, :conditions => ["current_ways.visible = ?", false], :include => :ways_via_history)
- way_ids = nodes_in_area.collect { |node| node.ways_via_history_ids }.flatten.uniq
+ nodes_in_area = Node.bbox(ymin, xmin, ymax, xmax).joins(:ways_via_history).where(:current_ways => { :visible => false })
+ way_ids = nodes_in_area.collect { |node| node.ways_via_history.invisible.collect { |way| way.id } }.flatten.uniq
[0,'',way_ids]
end
end
# get all the points
- points = Tracepoint.find_by_area(min_lat, min_lon, max_lat, max_lon, :offset => offset, :limit => TRACEPOINTS_PER_PAGE, :order => "gpx_id DESC, trackid ASC, timestamp ASC" )
+ points = Tracepoint.bbox(min_lat, min_lon, max_lat, max_lon).offset(offset).limit(TRACEPOINTS_PER_PAGE).order("gpx_id DESC, trackid ASC, timestamp ASC")
doc = XML::Document.new
doc.encoding = XML::Encoding::UTF_8
end
# FIXME um why is this area using a different order for the lat/lon from above???
- @nodes = Node.find_by_area(min_lat, min_lon, max_lat, max_lon, :conditions => {:visible => true}, :include => :node_tags, :limit => MAX_NUMBER_OF_NODES+1)
+ @nodes = Node.bbox(min_lat, min_lon, max_lat, max_lon).where(:visible => true).includes(:node_tags).limit(MAX_NUMBER_OF_NODES+1)
# get all the nodes, by tag not yet working, waiting for change from NickB
# need to be @nodes (instance var) so tests in /spec can be performed
#@nodes = Node.search(bbox, params[:tag])
nodes_to_fetch = (list_of_way_nodes.uniq - node_ids) - [0]
if nodes_to_fetch.length > 0
- @nodes += Node.find(nodes_to_fetch, :include => :node_tags)
+ @nodes += Node.includes(:node_tags).find(nodes_to_fetch)
end
visible_nodes = {}
end
end
- relations = Relation.find_for_nodes(visible_nodes.keys, :conditions => {:visible => true}) +
- Relation.find_for_ways(way_ids, :conditions => {:visible => true})
+ relations = Relation.nodes(visible_nodes.keys).visible +
+ Relation.ways(way_ids).visible
# we do not normally return the "other" partners referenced by an relation,
# e.g. if we return a way A that is referenced by relation X, and there's
# another way B also referenced, that is not returned. But we do make
# an exception for cases where an relation references another *relation*;
# in that case we return that as well (but we don't go recursive here)
- relations += Relation.find_for_relations(relations.collect { |r| r.id }, :conditions => {:visible => true})
+ relations += Relation.relations(relations.collect { |r| r.id }).visible
# this "uniq" may be slightly inefficient; it may be better to first collect and output
# all node-related relations, then find the *not yet covered* way-related ones etc.
endtime > starttime and endtime - starttime <= 24.hours
mask = (1 << zoom) - 1
- tiles = Node.count(:conditions => ["timestamp BETWEEN ? AND ?", starttime, endtime],
- :group => "maptile_for_point(latitude, longitude, #{zoom})")
+ tiles = Node.where(:timestamp => starttime .. endtime).group("maptile_for_point(latitude, longitude, #{zoom})").count
doc = OSM::API.new.get_xml_doc
changes = XML::Node.new 'changes'
def authorize_web
if session[:user]
- @user = User.find(session[:user], :conditions => {:status => ["active", "confirmed", "suspended"]})
+ @user = User.where(:status => ["active", "confirmed", "suspended"]).find(session[:user])
if @user.status == "suspended"
session.delete(:user)
created << elt.to_xml_node
else
# get the previous version from the element history
- prev_elt = elt.class.find(:first, :conditions =>
- ['id = ? and version = ?',
- elt.id, elt.version])
+ prev_elt = elt.class.where(:id => elt.id, :version => elt.version).first
unless elt.visible
# if the element isn't visible then it must have been deleted, so
# output the *previous* XML
@diary_entry.user = @user
if @diary_entry.save
- default_lang = @user.preferences.find(:first, :conditions => {:k => "diary.default_language"})
+ default_lang = @user.preferences.where(:k => "diary.default_language").first
if default_lang
default_lang.v = @diary_entry.language_code
default_lang.save!
render :action => 'edit'
end
else
- default_lang = @user.preferences.find(:first, :conditions => {:k => "diary.default_language"})
+ default_lang = @user.preferences.where(:k => "diary.default_language").first
lang_code = default_lang ? default_lang.v : @user.preferred_language
@diary_entry = DiaryEntry.new(:language_code => lang_code)
render :action => 'edit'
def list
if params[:display_name]
- @this_user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
+ @this_user = User.where(:status => ["active", "confirmed"]).find_by_display_name(params[:display_name])
if @this_user
@title = t 'diary_entry.list.user_title', :user => @this_user.display_name
end
def rss
+ @entries = DiaryEntry.includes(:user).order("created_at DESC").limit(20)
+
if params[:display_name]
- user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
+ user = User.where(:status => ["active", "confirmed"]).find_by_display_name(params[:display_name])
if user
- @entries = DiaryEntry.find(:all,
- :conditions => {
- :user_id => user.id,
- :visible => true
- },
- :order => 'created_at DESC',
- :limit => 20)
+ @entries = @entries.where(:user_id => user.id, :visible => true )
@title = I18n.t('diary_entry.feed.user.title', :user => user.display_name)
@description = I18n.t('diary_entry.feed.user.description', :user => user.display_name)
@link = "http://#{SERVER_URL}/user/#{user.display_name}/diary"
render :nothing => true, :status => :not_found
end
elsif params[:language]
- @entries = DiaryEntry.find(:all, :include => :user,
- :conditions => {
- :users => { :status => ["active", "confirmed"] },
- :visible => true,
- :language_code => params[:language]
- },
- :order => 'created_at DESC',
- :limit => 20)
+ @entries = @entries.where(:users => { :status => ["active", "confirmed"] },
+ :visible => true,
+ :language_code => params[:language])
@title = I18n.t('diary_entry.feed.language.title', :language_name => Language.find(params[:language]).english_name)
@description = I18n.t('diary_entry.feed.language.description', :language_name => Language.find(params[:language]).english_name)
@link = "http://#{SERVER_URL}/diary/#{params[:language]}"
else
- @entries = DiaryEntry.find(:all, :include => :user,
- :conditions => {
- :users => { :status => ["active", "confirmed"] },
- :visible => true
- },
- :order => 'created_at DESC',
- :limit => 20)
+ @entries = @entries.where(:users => { :status => ["active", "confirmed"] },
+ :visible => true)
@title = I18n.t('diary_entry.feed.all.title')
@description = I18n.t('diary_entry.feed.all.description')
@link = "http://#{SERVER_URL}/diary"
end
def view
- user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
+ user = User.where(:status => ["active", "confirmed"]).find_by_display_name(params[:display_name])
if user
- @entry = DiaryEntry.find(:first, :conditions => {
- :id => params[:id],
- :user_id => user.id,
- :visible => true
- })
+ @entry = DiaryEntry.where(:id => params[:id],
+ :user_id => user.id,
+ :visible => true).first
if @entry
@title = t 'diary_entry.view.title', :user => params[:display_name], :title => @entry.title
else
@to_user = User.find_by_display_name(params[:display_name])
if @to_user
if params[:message]
- if @user.sent_messages.count(:conditions => ["sent_on >= ?", Time.now.getutc - 1.hour]) >= MAX_MESSAGES_PER_HOUR
+ if @user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR
flash[:error] = t 'message.new.limit_exceeded'
else
@message = Message.new(params[:message])
def mark
if params[:message_id]
id = params[:message_id]
- message = Message.find_by_id(id, :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id])
+ message = Message.where(:id => id).where("to_user_id = ? OR from_user_id = ?", @user.id, @user.id).first
if params[:mark] == 'unread'
message_read = false
notice = t 'message.mark.as_unread'
def delete
if params[:message_id]
id = params[:message_id]
- message = Message.find_by_id(id, :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id])
+ message = Message.where(:id => id).where("to_user_id = ? OR from_user_id = ?", @user.id, @user.id).first
message.from_user_visible = false if message.sender == @user
message.to_user_visible = false if message.recipient == @user
if message.save
end
def version
- old_node = OldNode.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
- if old_node.nil?
- # (RecordNotFound is not raised with find :first...)
+ if old_node = OldNode.where(:id => params[:id], :version => params[:version]).first
+ response.headers['Last-Modified'] = old_node.timestamp.rfc822
+
+ doc = OSM::API.new.get_xml_doc
+ doc.root << old_node.to_xml_node
+
+ render :text => doc.to_s, :content_type => "text/xml"
+ else
render :nothing => true, :status => :not_found
- return
end
-
- response.headers['Last-Modified'] = old_node.timestamp.rfc822
-
- doc = OSM::API.new.get_xml_doc
- doc.root << old_node.to_xml_node
-
- render :text => doc.to_s, :content_type => "text/xml"
end
end
end
def version
- old_relation = OldRelation.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
- if old_relation.nil?
- # (RecordNotFound is not raised with find :first...)
+ if old_relation = OldRelation.where(:id => params[:id], :version => params[:version]).first
+ response.headers['Last-Modified'] = old_relation.timestamp.rfc822
+
+ doc = OSM::API.new.get_xml_doc
+ doc.root << old_relation.to_xml_node
+
+ render :text => doc.to_s, :content_type => "text/xml"
+ else
render :nothing => true, :status => :not_found
- return
end
-
- response.headers['Last-Modified'] = old_relation.timestamp.rfc822
-
- doc = OSM::API.new.get_xml_doc
- doc.root << old_relation.to_xml_node
-
- render :text => doc.to_s, :content_type => "text/xml"
end
end
end
def version
- old_way = OldWay.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
- if old_way.nil?
- # (RecordNotFound is not raised with find :first...)
+ if old_way = OldWay.where(:id => params[:id], :version => params[:version]).first
+ response.headers['Last-Modified'] = old_way.timestamp.rfc822
+
+ doc = OSM::API.new.get_xml_doc
+ doc.root << old_way.to_xml_node
+
+ render :text => doc.to_s, :content_type => "text/xml"
+ else
render :nothing => true, :status => :not_found
- return
end
-
- response.headers['Last-Modified'] = old_way.timestamp.rfc822
-
- doc = OSM::API.new.get_xml_doc
- doc.root << old_way.to_xml_node
-
- render :text => doc.to_s, :content_type => "text/xml"
end
end
# next load the relations and the ways.
- relations = Relation.find(relation_ids, :include => [:relation_tags])
- ways = Way.find(way_ids, :include => [:way_nodes, :way_tags])
+ relations = Relation.where(:id => relation_ids).includes(:relation_tags)
+ ways = Way.where(:id => way_ids).includes(:way_nodes, :way_tags)
# now additionally collect nodes referenced by ways. Note how we
# recursively evaluate ways but NOT relations.
way.way_nodes.collect { |way_node| way_node.node_id }
}
node_ids += way_node_ids.flatten
- nodes = Node.find(node_ids.uniq, :include => :node_tags)
+ nodes = Node.where(:id => node_ids.uniq).includes(:node_tags)
# create XML.
doc = OSM::API.new.get_xml_doc
end
def relations_for_object(objtype)
- relationids = RelationMember.find(:all, :conditions => ['member_type=? and member_id=?', objtype, params[:id]]).collect { |ws| ws.id[0] }.uniq
+ relationids = RelationMember.where(:member_type => objtype, :member_id => params[:id]).collect { |ws| ws.id[0] }.uniq
doc = OSM::API.new.get_xml_doc
# from display name, pick up user id if one user's traces only
display_name = params[:display_name]
if !display_name.blank?
- target_user = User.find(:first, :conditions => { :status => ["active", "confirmed"], :display_name => display_name })
+ target_user = User.where(:status => ["active", "confirmed"], :display_name => display_name).first
if target_user.nil?
@title = t'trace.no_such_user.title'
@not_found_user = display_name
# 4 - user's traces, not logged in as that user = all user's public traces
if target_user.nil? # all traces
if @user
- conditions = ["(gpx_files.visibility in ('public', 'identifiable') OR gpx_files.user_id = ?)", @user.id] #1
+ @traces = Trace.where("visibility IN ('public', 'identifiable') OR user_id = ?", @user.id) #1
else
- conditions = ["gpx_files.visibility in ('public', 'identifiable')"] #2
+ @traces = Trace.where("visibility IN ('public', 'identifiable')") #2
end
else
if @user and @user == target_user
- conditions = ["gpx_files.user_id = ?", @user.id] #3 (check vs user id, so no join + can't pick up non-public traces by changing name)
+ @traces = Trace.where(:user_id => @user.id) #3 (check vs user id, so no join + can't pick up non-public traces by changing name)
else
- conditions = ["gpx_files.visibility in ('public', 'identifiable') AND gpx_files.user_id = ?", target_user.id] #4
+ @traces = Trace.where("visibility IN ('public', 'identifiable') AND user_id = ?", target_user.id) #4
end
end
if params[:tag]
@tag = params[:tag]
- files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id }
+ files = Tracetag.where(:tag => params[:tag]).select(:gpx_id).all
if files.length > 0
- conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
- else
- conditions[0] += " AND 0 = 1"
+ @traces = @traces.where(:id => files.collect { |tt| tt.gpx_id })
end
end
- conditions[0] += " AND gpx_files.visible = ?"
- conditions << true
-
@page = (params[:page] || 1).to_i
@page_size = 20
- @traces = Trace.find(:all,
- :include => [:user, :tags],
- :conditions => conditions,
- :order => "gpx_files.timestamp DESC",
- :offset => (@page - 1) * @page_size,
- :limit => @page_size)
+ @traces = @traces.where(:visible => true)
+ @traces = @traces.order("timestamp DESC")
+ @traces = @traces.offset((@page - 1) * @page_size)
+ @traces = @traces.limit(@page_size)
+ @traces = @traces.includes(:user, :tags)
# put together SET of tags across traces, for related links
tagset = Hash.new
- if @traces
- @traces.each do |trace|
- trace.tags.reload if params[:tag] # if searched by tag, ActiveRecord won't bring back other tags, so do explicitly here
- trace.tags.each do |tag|
- tagset[tag.tag] = tag.tag
- end
+ @traces.each do |trace|
+ trace.tags.reload if params[:tag] # if searched by tag, ActiveRecord won't bring back other tags, so do explicitly here
+ trace.tags.each do |tag|
+ tagset[tag.tag] = tag.tag
end
end
end
def georss
- conditions = ["gpx_files.visibility in ('public', 'identifiable')"]
+ traces = Trace.where(:visibility => [:public, :identifiable])
if params[:display_name]
- conditions[0] += " AND users.display_name = ?"
- conditions << params[:display_name]
+ traces = traces.where(:users => {:display_name => params[:display_name]})
end
if params[:tag]
- conditions[0] += " AND EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)"
- conditions << params[:tag]
+ traces = traces.where("EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)")
end
- traces = Trace.find(:all, :include => :user, :conditions => conditions,
- :order => "timestamp DESC", :limit => 20)
+ traces = traces.order("timestamp DESC")
+ traces = traces.limit(20)
+ traces = traces.includes(:user)
rss = OSM::GeoRSS.new
end
# Finally save the user's preferred privacy level
- if pref = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
+ if pref = @user.preferences.where(:k => "gps.trace.visibility").first
pref.v = visibility
pref.save
else
end
def default_visibility
- visibility = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
+ visibility = @user.preferences.where(:k => "gps.trace.visibility").first
if visibility
visibility.v
- elsif @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
+ elsif @user.preferences.where(:k => "gps.trace.public", :v => "default").first.nil?
"private"
else
"public"
def save
@title = t 'user.new.title'
- if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"})
+ if Acl.address(request.remote_ip).where(:k => "no_account_creation").exists?
render :action => 'new'
elsif params[:decline]
if @user
def account
@title = t 'user.account.title'
- @tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
+ @tokens = @user.oauth_tokens.where('oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null')
if params[:user] and params[:user][:display_name] and params[:user][:description]
@user.display_name = params[:user][:display_name]
@title = t 'user.lost_password.title'
if params[:user] and params[:user][:email]
- user = User.find_by_email(params[:user][:email], :conditions => {:status => ["pending", "active", "confirmed"]})
+ user = User.where(:email => params[:user][:email], :status => ["pending", "active", "confirmed"]).first
if user
token = user.tokens.create
def make_friend
if params[:display_name]
name = params[:display_name]
- new_friend = User.find_by_display_name(name, :conditions => {:status => ["active", "confirmed"]})
+ new_friend = User.where(:display_name => name, :status => ["active", "confirmed"]).first
friend = Friend.new
friend.user_id = @user.id
friend.friend_user_id = new_friend.id
def remove_friend
if params[:display_name]
name = params[:display_name]
- friend = User.find_by_display_name(name, :conditions => {:status => ["active", "confirmed"]})
+ friend = User.where(:display_name => name, :status => ["active", "confirmed"]).first
if @user.is_friends_with?(friend)
Friend.delete_all "user_id = #{@user.id} AND friend_user_id = #{friend.id}"
flash[:notice] = t 'user.remove_friend.success', :name => friend.display_name
end
def full
- way = Way.find(params[:id], :include => {:nodes => :node_tags})
+ way = Way.includes(:nodes => :node_tags).find(params[:id])
if way.visible
changeset_cache = {}
# :id parameter. note that this used to return deleted ways as well, but
# this seemed not to be the expected behaviour, so it was removed.
def ways_for_node
- wayids = WayNode.find(:all,
- :conditions => ['node_id = ?', params[:id]]
- ).collect { |ws| ws.id[0] }.uniq
+ wayids = WayNode.where(:node_id => params[:id]).collect { |ws| ws.id[0] }.uniq
doc = OSM::API.new.get_xml_doc
class Acl < ActiveRecord::Base
- def self.find_by_address(address, options)
- self.with_scope(:find => {:conditions => ["#{inet_aton} & netmask = address", address]}) do
- return self.find(:first, options)
- end
- end
-
- def self.find_all_by_address(address, options)
- self.with_scope(:find => {:conditions => ["#{inet_aton} & netmask = address", address]}) do
- return self.find(:all, options)
- end
- end
+ scope :address, lambda { |address| where("#{inet_aton} & netmask = address", address) }
private
validate :validate_position
validates_associated :changeset
+ scope :visible, where(:visible => true)
+ scope :invisible, where(:visible => false)
+
# Sanity check the latitude and longitude and add an error if it's broken
def validate_position
errors.add_to_base("Node is not in the world") unless in_world?
validates_numericality_of :changeset_id, :version, :integer_only => true
validates_associated :changeset
+ scope :visible, where(:visible => true)
+ scope :invisible, where(:visible => false)
+ scope :nodes, lambda { |*ids| joins(:relation_members).where(:current_relation_members => { :member_type => "Node", :member_id => ids }) }
+ scope :ways, lambda { |*ids| joins(:relation_members).where(:current_relation_members => { :member_type => "Way", :member_id => ids }) }
+ scope :relations, lambda { |*ids| joins(:relation_members).where(:current_relation_members => { :member_type => "Relation", :member_id => ids }) }
+
TYPES = ["node", "way", "relation"]
def self.from_xml(xml, create=false)
return el1
end
- def self.find_for_nodes(ids, options = {})
- if ids.empty?
- return []
- else
- self.with_scope(:find => { :joins => "INNER JOIN current_relation_members AS crm ON crm.id = current_relations.id", :conditions => "crm.member_type = 'Node' AND crm.member_id IN (#{ids.join(',')})" }) do
- return self.find(:all, options)
- end
- end
- end
-
- def self.find_for_ways(ids, options = {})
- if ids.empty?
- return []
- else
- self.with_scope(:find => { :joins => "INNER JOIN current_relation_members AS crm ON crm.id = current_relations.id", :conditions => "crm.member_type = 'Way' AND crm.member_id IN (#{ids.join(',')})" }) do
- return self.find(:all, options)
- end
- end
- end
-
- def self.find_for_relations(ids, options = {})
- if ids.empty?
- return []
- else
- self.with_scope(:find => { :joins => "INNER JOIN current_relation_members AS crm ON crm.id = current_relations.id", :conditions => "crm.member_type = 'Relation' AND crm.member_id IN (#{ids.join(',')})" }) do
- return self.find(:all, options)
- end
- end
- end
-
# FIXME is this really needed?
def members
unless @members
validates_numericality_of :id, :on => :update, :integer_only => true
validates_associated :changeset
+ scope :visible, where(:visible => true)
+ scope :invisible, where(:visible => false)
+
# Read in xml as text and return it's Way object representation
def self.from_xml(xml, create=false)
begin
</tr>
<tr valign="top">
<td class="fieldName"><%= t 'diary_entry.edit.language' -%></td>
- <td><%= f.collection_select :language_code, Language.find(:all, :order => :english_name), :code, :name %></td>
+ <td><%= f.collection_select :language_code, Language.order(:english_name), :code, :name %></td>
</tr>
<tr valign="top">
<td class="fieldName"><%= t 'diary_entry.edit.location' -%></td>
<h1><%= t 'user.new.heading' %></h1>
-<% if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"}) %>
+<% if Acl.address(request.remote_ip).where(:k => "no_account_creation").exists? %>
<p><%= t 'user.new.no_auto_account_create' %></p>
SCALE = 10000000
def self.included(base)
- base.extend(ClassMethods)
+ base.scope :bbox, lambda { |minlat,minlon,maxlat,maxlon| base.where(OSM.sql_for_area(minlat, minlon, maxlat, maxlon)) }
base.before_save :update_tile
end
def lat2y(a)
180/Math::PI * Math.log(Math.tan(Math::PI/4+a*(Math::PI/180)/2))
end
-
- module ClassMethods
- def find_by_area(minlat, minlon, maxlat, maxlon, options)
- self.with_scope(:find => {:conditions => OSM.sql_for_area(minlat, minlon, maxlat, maxlon)}) do
- return self.find(:all, options)
- end
- end
- end
end