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

FreeBSD 14.0, Ruby on Rails deployment issues (gem sqlite3 not installing)

I'm trying to deploy rails in FreeBSD 14.0 and when I try to deploy a new project, using rails new truck command I'm receiving the following error:package configuration for...

View Article


Restrict file upload to some file extensions

I am having a problem with uploading files. I want to allow users to upload files that the system allows...For example, I allow files having an extension of *.jpg to be uploaded by users. So, in the...

View Article


How to make Cucumber/Capybara close or quit the browser session after test...

I am having some issues in Jenkins. After test execution completes, the browser session is still alive, which is creating some other issue in the pipeline. So I want to quit the browser session after...

View Article

How declaration of nested arrays interpreted in Ruby?

While i was working on arrays, I missed a comma in declaration of the nested array in Ruby but language interpreting this in other way. If anyone familiar about this behaviour please give a thought.arr...

View Article

Bundler: always use latest revision of git branch in Gemfile

I have a Gemfile with a private git repo in the following format:gem 'magic_beans', :git => "git@git.example.com:magic_beans.git', :branch => 'super_beans'When I bundle install, the Gemfile.lock...

View Article


Converting keys of hash into camelcase

hash = {test_user: '1', user_details: {first_name: "Test"}}output = {testUser: '1', userDetails: {firstName: "Test"}}Program: new_hash = {} if hash.values.map{|x| x.class}.include?(Hash) hash.each do...

View Article

Psych gem dependancy failed

In my new windows pc i am setting up new rails application but while executing bundle install Psych dependancy is failed and i am stuck in this i have tried many solution but it didn't worked well if...

View Article

Rails 7.1.2 Invalid HTTP format, parsing fails Are you trying to open an SSL...

I generated the credentials with:$ EDITOR="code --wait" bin/rails credentials:edit --environment productionAdding config/credentials/production.key to store the encryption key:...

View Article


Why does Ruby support trailing commas in method invocations but not in method...

For example, this is valid Ruby:def foo(bar, baz); endfoo(1, 2,)but this is notdef foo(bar, baz,); end # syntax error, unexpected ')' (SyntaxError)foo(1,2,)

View Article


Configuring middleware to unblock Azure domain for Rails app

I'm developing a Rails application. I created a Web App on Azure so that the Rails app can be accessed by others for testing purposes. I got everything configured as far as Azure goes, but when I try...

View Article

How to fetch events from the Google Calendar API with a Rails JSON API

Right now I receive an error:Required parameter is missing: grant_typeWhen using the retrieve_events controller action. module Api module V1 class EventsController < ApplicationController require...

View Article

Navigate to Ruby function definition in VS Code

I'm pretty new to Visual Studio Code, and I'm trying to edit some Ruby code. I installed Ruby support, and I enabled the language server, but Ctrl-clicking on a function name doesn't work, and neither...

View Article

Trouble installing libv8 to use with mini_racer (github page site project...

Hi guys, I'm working on my first website ever using github page site. I've been following this tutorial on Youtube.I forked a theme from another person to use with my project. After forking and some...

View Article


How can I change the background color of specific characters in a RTF document?

I'm trying to output RTF (Rich Text Format) from a Ruby program - and I'd prefer to just emit RTF directly without using the RTF gem as I'm doing pretty simple stuff.I would like to highlight specific...

View Article

On Apple Silicon: ruby-build: definition not found: 3.0.0

When I try to install the latest ruby (3.0.0), it fails with:ruby-build: definition not found: 3.0.0Clearly, ruby 3 has been released more than a month ago, so I'm guessing the team is running into...

View Article


Ruby on Rails Test – Reset/Refresh Validators?

I am writing tests for a RoR Gem that has a validation that is dependent on a configuration variable:class MyModel < ApplicationRecord validates_length_of :field_name, minimum:...

View Article

Create or Initialize. How to minimize the load on database and server

I write in ruby, in the ruby on rails framework. I can't understand the hypothetical situation.Let's say the get_date function returns an array of about 10 million elements. Each element contains the...

View Article


What does `+""` mean in Ruby? [duplicate]

I just found this piece of code (simplified) in a pull request in the Ruby on Rails GitHub repository:def foo(string) return +"" if string.empty? # ...endAnd I wonder what the +"" means?What difference...

View Article

Are there risks to doing ObjectSpace.undefine_finalizer(tempfile)?

When a file is uploaded, I receive a ActionDispatch::Http::UploadedFile, which contains a tempfile, that will get cleaned up when the gc cleans it up.Now I would like to create a job that runs in the...

View Article

Where is SECRET_KEY_BASE environment variable located when I start Rails app...

In the Rails 4 In Action Book, it states that after doing some other setup: the final setup to boot up your rails app in production mode (with web brick) is to enter this command in...

View Article
Browsing all 4633 articles
Browse latest View live


Latest Images