flash[:notice] = { :partial => "preferences/update_success_flash" }
redirect_to preferences_path
else
- flash[:error] = t ".failure"
+ flash.now[:error] = t ".failure"
render :edit
end
end
flash[:notice] = t ".success"
redirect_to user_path(current_user)
else
- flash[:error] = t ".failure"
+ flash.now[:error] = t ".failure"
render :edit
end
end
redirect_to helpers.reportable_url(@report.issue.reportable), :notice => t(".successful_report")
else
- flash[:notice] = t(".provide_details")
+ flash.now[:notice] = t(".provide_details")
render :action => "new"
end
end
end
def attach_project_logo
- attachments.inline["logo.png"] = File.read(Rails.root.join("app/assets/images/osm_logo_30.png"))
+ attachments.inline["logo.png"] = Rails.root.join("app/assets/images/osm_logo_30.png").read
end
def attach_user_avatar(user)
avatar.blob.download
end
else
- File.read(Rails.root.join("app/assets/images/avatar_small.png"))
+ Rails.root.join("app/assets/images/avatar_small.png").read
end
end
# Otherwise, admins might not be aware that they are now silently ignored
# and major problems could occur
# rubocop:disable Rails/Output, Rails/Exit
-if File.exist?(Rails.root.join("config/application.yml"))
+if Rails.root.join("config/application.yml").exist?
puts "The config/application.yml file is no longer supported."
puts ""
puts "Default settings are now found in config/settings.yml and you"
def self.load_countries
countries = {}
- xml = REXML::Document.new(File.read(Rails.root.join("config/countries.xml")))
+ xml = REXML::Document.new(Rails.root.join("config/countries.xml").read)
xml.elements.each("geonames/country") do |ele|
code = ele.get_text("countryCode").to_s
end
def test_large_picture
- picture = File.read(Rails.root.join("test/gpx/fixtures/a.gif"), :mode => "rb")
+ picture = Rails.root.join("test/gpx/fixtures/a.gif").read(:mode => "rb")
trace = create(:trace, :fixture => "a")
assert_equal picture, trace.large_picture
end
def test_icon_picture
- picture = File.read(Rails.root.join("test/gpx/fixtures/a_icon.gif"), :mode => "rb")
+ picture = Rails.root.join("test/gpx/fixtures/a_icon.gif").read(:mode => "rb")
trace = create(:trace, :fixture => "a")
assert_equal picture, trace.icon_picture