conditions << @tag
end
- conditions[0] += " AND gpx_files.visible = 1" #FIXME: use boolean true as parameter to active record
+ conditions[0] += " AND gpx_files.visible = ?"
+ conditions << true
@trace_pages, @traces = paginate(:traces,
:include => [:user, :tags],
def mine
if @user
+ @trace = Trace.new
+ unless @user.trace_public_default.nil?
+ @trace.public = true
+ else
+ @trace.public = false
+ end
list(@user, "mine") unless @user.nil?
else
redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri
end
def georss
- conditions = ["gpx_files.public = 1"] # fixme pass boolean true as parameter
+ conditions = ["gpx_files.public = ?", true]
if params[:display_name]
conditions[0] += " AND users.display_name = ?"
else
FileUtils.rm_f(filename)
end
+
+ # Finally save whether the user marked the trace as being public
+ if @trace.public?
+ if @user.trace_public_default.nil?
+ @user.preferences.create(:k => "gps.trace.public", :v => "default")
+ end
+ else
+ pref = @user.trace_public_default
+ pref.destroy unless pref.nil?
+ end
+
end
end