I am trying to display the progress percentage when i upload a file and unzip it. I am using ruby-zip to unzip the file. While unzipping I increment the counter and store it in database. I have a form like
<% form_tag '/unzip', :multipart => true…
I have a pretty large rails app (Rails 3.2.3), using the asset pipeline. There are are quite a few files in the assets folder.
Under 1.8.7, running rake assets:precompile takes 4 minutes. This is long, but due to the sheer number of assets I'm…
I have a link as follows that I'm trying to test (please ignore the square brackets):
[%= link_to "Delete User", destroy_user_account_path(@profile.user),
:class => "delete", :confirm => "a", :title => "Delete #{@profile.user.name}", :method =>…
I have the following:
article_results.keys do |key|
article_results[key].map! do |a|
a[:filename] = c.filename
a[:sitename] = c.site_name
a
end
end
As I want to add to each element of each array within the hash dynamically, but for…
In my Rails 3 app, I am fetching path_info by:
Rails.application.routes.recognize_path(url, { :method => request.request_method }) rescue {}
If a crawler hits a URL like "http://localhost:3000/admin_", the above code raises following…
Why would a unicode encoding get lost when sending it to an ODBC-interface via the dbi-gem?
We wrote an sinatra-application that connects via DBI to an SAP HANA database. The latter shouldn't matter as I can manually execute Statements with UTF8…
Preface: We are working hard to upgrade our apps Ruby and Rails versions, but need to work with what we're on at the moment.
We have functionality to export data to CSV in our RoR app.
We recently upgraded to Ruby 1.8.7, Rails 3.1, and the…
I have problem with using rspec-mocks.
bundle list shows:
Gems included by the bundle:
* CFPropertyList (2.2.8)
* builder (3.2.2)
* bundler (1.7.12)
* ci_reporter (1.9.3)
* diff-lcs (1.2.5)
* excon (0.44.0)
* facter (2.4.0)
* hiera…
I have a big hash with lots of nested key value pairs.
Eg.
h = {"foo" => {"bar" => {"hello" => {"world" => "result" } } } }
Now I want to access result and I have keys for that in array in proper sequence.
keys_arr = ["foo", "bar", "hello",…
I have certain classes that are implemented as decorators in my Rails app which is on Ruby 1.8.7 . I keep getting the warning - warning: already initialized constant ABC . Here ABC is the name of the constant.
To solve this, I'm using the…
When I try to install cucumber 0.93 this error is triggered.
I need to install this specific version.
trabajo@fernando-Inspiron-1545:~/cucumber-rspec$ gem install cucumber -v 0.9.3
Building native extensions. This could take a while...
ERROR: …
Im trying to implement google youtube api in my ruby on rails project as stated in youtube documentation https://developers.google.com/youtube/v3/code_samples/ruby#retrieve_my_uploads so this block of code
require 'google/api_client'
I get the…
I have a bit of code for escaping double-quotes from a string which may include pre-escaped quotes; e.g:
This is a \"string"
Using the following code with Ruby 1.8.7p374:
string.gsub!(/([^\\])"/, '\1\"')
However, I get some funny edge-case when…
I know how select, collect and map work in Ruby. I was just wondering if there is a similar native Ruby method that can combine them & give results in a single iteration without having the need to remove nil from array?
For ex.
(1..10).map { |x| x*3…
I have the following method in our Ruby 1.8.7 project:
def self.ping_server
request_data = get_request_data
uri = 'another_server.our_company.com'
https = Net::HTTP.new(uri)
https.use_ssl = true
path = "/our_service"
data =…