ruby

How to scroll within a table using watir-scroll

牧云@^-^@ 提交于 2021-02-10 06:41:08
问题 I have an application in which there is a dynamic table, rows are loaded only when you scroll up or down. Watir-scroll is scrolling the entire page. Is there anyway I can perform the scrolling within that table? 回答1: Making an element scrollable is often done by setting the overflow style. It is likely on a div that contains the table . For example: <html> <body> <div style="overflow:scroll; height:250px;"> <table> <tr height="200px"><td>Cell A</td></tr> <tr height="200px"><td>Cell B</td></tr

Ruby - replace words in a string if instances do not match

送分小仙女□ 提交于 2021-02-10 06:14:20
问题 First time on Stackvoverflow so hope I am posting this correctly & as clear as possible. Please feel free to rip this apart and let me know how to post clearer questions in the future if need be. Newbie to Ruby here and practising where I can. I want to know how to replace instances in a string in ruby. for example: say I have: string = 'richard julie richard julie sam letty sam letty' How would I replace any instance in the string, that does not equal 'richard' or 'julie' & replace with the

Prawn PDF Compression, compress content streams, what does it do

空扰寡人 提交于 2021-02-10 05:59:57
问题 The prawn gem has an initialize option :compress , which is described here. Apparently it "Compresses content streams before rendering them" . With and without compress: true I generated the same 14 page pdf twice. Each page has 2 photos and all sorts of text. The resulting file size was the exact same. So my question is: in production with larger quantities of photos will I see a difference in file sizes? Or maybe compress: true eats more or less RAM during processing? What is its purpose?

Prawn PDF Compression, compress content streams, what does it do

∥☆過路亽.° 提交于 2021-02-10 05:59:06
问题 The prawn gem has an initialize option :compress , which is described here. Apparently it "Compresses content streams before rendering them" . With and without compress: true I generated the same 14 page pdf twice. Each page has 2 photos and all sorts of text. The resulting file size was the exact same. So my question is: in production with larger quantities of photos will I see a difference in file sizes? Or maybe compress: true eats more or less RAM during processing? What is its purpose?

How to test conditional ActiveRecord after_update callback with rspec?

寵の児 提交于 2021-02-10 05:52:10
问题 I have a conditional callback that triggers a job. If the manager changes, it should call the method class Employee < ActiveRecord::Base after_update :employee_manager_on_change, if: :employee_id_changed? def employee_manager_on_change EmployeeManagerChangedJob.perform_later(id) end end I'm having trouble to test this. I needed something like context 'when changing manager' do subject { user.manager = new_manager } it 'calls employee_manager_on_change' do expect { suject.run_callbacks :update

Errors when trying “rails new” after a new install

徘徊边缘 提交于 2021-02-10 05:46:09
问题 I'm just getting started downloading all my programs. I ran into an issue I didn't understand that was resolved using this stackoverflow thread. It worked perfectly. I then followed the basic instructions on this page and when I got to step 4 rails new test_app I received the following error. /Users/Hansen/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'railties' (>= 0) among 8 total gem(s) (Gem::LoadError) from /Users/Hansen/.rvm/rubies/ruby-2

Irreversible migration, can it be fixed? - Rails 4

南笙酒味 提交于 2021-02-10 05:42:47
问题 So i made a migration like this class AddDatetimeAttrToUsers < ActiveRecord::Migration def change change_column :users, :oauth_expires_at, :datetime end end on my local environment it works just fine but when i try heroku run rake db:migrate i get an error ERROR: column "oauth_expires_at" cannot be cast automatically to type timestamp without time zone HINT: Specify a USING expression to perform the conversion. When i searched it, i created a new migration like this as best practice for

rvm install 2.1.4 hangs on OSX

一笑奈何 提交于 2021-02-10 04:07:30
问题 when attempting to install a new version of ruby with the command: rvm install 2.1.4 the process hangs in the middle of compiling: ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... ruby-2.1.4 - #extracting ruby-2.1.4 to /Users/alutz/.rvm/src/ruby-2.1.4.... ruby-2.1.4 - #configuring..................................................... ruby-2.1.4 - #post-configuration. ruby-2.1.4 - #compiling.......\ 回答1: This solved my issue: rvm install 2.1.4 -- -

rvm install 2.1.4 hangs on OSX

て烟熏妆下的殇ゞ 提交于 2021-02-10 04:01:22
问题 when attempting to install a new version of ruby with the command: rvm install 2.1.4 the process hangs in the middle of compiling: ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... ruby-2.1.4 - #extracting ruby-2.1.4 to /Users/alutz/.rvm/src/ruby-2.1.4.... ruby-2.1.4 - #configuring..................................................... ruby-2.1.4 - #post-configuration. ruby-2.1.4 - #compiling.......\ 回答1: This solved my issue: rvm install 2.1.4 -- -