Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Browsing all 4615 articles
Browse latest View live
↧

How do Ruby programmers do type checking?

Since there is no type in ruby, how do Ruby programmers make sure a function receives correct arguments? Right now, I am repeating if object.kind_of/instance_of statements to check and raise runtime...

View Article


Rspec - How to replace receive by have_received when dealing with an expect...

I have the following Ruby class I want to test:class Logger # ... def process X.process rescue StandardError => e ::Rails.logger.error('Progname') { 'Could not produce the audit log' }...

View Article


Compare TZINFO Country

How can I only keep the most relevant TZINFO object in ruby when I have two with the same timezone.E.g. Australia returns "Asia/Tokyo" as one of its timezones, but Japan also has "Asia/Tokyo" as a...

View Article

Is it possible to run a single test in MiniTest?

I can run all tests in a single file with:rake test TEST=path/to/test_file.rbHowever, if I want to run just one test in that file, how would I do it?I'm looking for similar functionality to:rspec...

View Article

Undefined method `create_table' for ActiveRecord::SchemaMigration:Class...

When i create padrino framework with sqlite3 and activerecord.padrino rake ar:migrate@schema_migration.create_tableOr when:padrino rake ar:schema:dump undefined method `with_connection' for...

View Article


How to set precision value by default in rails

By default migration precision will be nilIf you want to change through migration we can dobut by default can we able to set it over configuration. or Application.rb

View Article

Getting exit status in ensure block

I'm writing a script that might exit normally in many different points in the program. The script currently always outputs a message to STDOUT in an ensure block, sorta like this:begin exitensure puts...

View Article

What tools do web developers use with PHP, Ruby on Rails, Python, etc? [closed]

A good friend just sent me the following emailMy father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, he’s proposing they teach web...

View Article


How to get Timezone with geocode gem?

I have to add a time_zone_select into my Rails application. I was considering some gems to put a default value based on the user request, but I've seen that the project has already installed geocode...

View Article


Rack::Request - how do I get all headers?

The title is pretty self-explanatory. Is there any way to get the headers (except for Rack::Request.env[])?

View Article

How do I test the order of method calls in rspec?

I have a class that uses the command pattern to do a bunch of simple transformation steps in order. Data comes in as a data feed (in XML) and then is transformed through multiple steps using...

View Article

DRb -- Marshal via JSON to accommodate a non-ruby remote object

I need communication between a couple of process types, most of which will be ruby processes, but a very important process type I'll need to communicate with will be a python process.I came across DRb...

View Article

How to best secure an API key in an iframe widget

I am developing a Javascript widget which will be embedded on client sites using an Iframe.The widget code makes an API call to my backend service using an API key. The API key for each different...

View Article


Generating client assertion token with Ruby

I'm writing this here to document my experience somewhere on the internet, so anyone else searching for this can save a few hours.I kept getting the following error when trying to authenticate using...

View Article

If I defined a Ruby method in IRB, how do I edit that method without retyping...

Say I am running IRB and I type this into the console:def full_name(first, last) puts "Your full name is: #{first, '', last}"endSay, that I wanted to edit that to include the parameter middle, how...

View Article


How can I add Adminer to my Ruby on Rails application with PostgreSQL?

I am new to ruby on rails. This question may be simple. I have been trying to add an adminer folder on the app on ruby on rails application. My database is PostgreSQL. I want to manage my database on...

View Article

Why does SimpleCov generate a coverage report before running tests?

I'm trying to build a Ruby gem. I set up a development environment using a Docker image based on Ruby 3.3 and a devcontainer.I initialized a gem using the bundle gem tooling. This set up the basic...

View Article


RSpec: Stub private method

I try to test a class with RSpec2, that has some private methods, which are called from some public methods. I test the public methods with@foo.should_receive(:start_training).exactly(2).timesif they...

View Article

Image may be NSFW.
Clik here to view.

Ask your team for your master key and write it to /rails/config/master.key or...

Rails 8.0.1 .. can somebody help? Master key is set in env variables and is equal to value in config/master.keyCannot deploy to redner.com#18 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails...

View Article

When sending a reply with the Gmail API, is there a way to include the text...

When I use the MS Graph API to reply to emails, it automatically adds the quoted text to the reply email from previous emails in the email thread. Is there a way to accomplish this with the Gmail API...

View Article
Browsing all 4615 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>