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

Updating a serialized field in Rails

I have a serialized attribute in my Rails model and am attempting to update it. The Block#preferences attribute was first generated through a migration as a text type. We use Postgresql 14.# == Schema...

View Article


DEPRECATION WARNING: The configuration option `config.serve_static_assets`...

My rails app, Rails 4.2.6, had been working perfectly but, after running the bundle exec rails server command as usual to start my web server for development I got this error message:DEPRECATION...

View Article


Naming conventions for boolean attributes

I want to write code that others easily can understand as well. Do boolean attributes like hide_email or email_hidden have a convention style?

View Article

How to factor out code into methods in a Ruby script while retaining access...

Suppose I have a Ruby script like the following to generate YAML describing a list of services:require 'yaml'environment_slug = ENV.fetch('CI_ENVIRONMENT_SLUG')YAML.dump([ {'name' =>...

View Article

Excel-Style Conditional Formatting for Numbers in Rails

I'm writing a sales app where items have a :savings attribute that ranges from 0 to 100 (%). I'm hoping to have the background color of the cell in which that attribute is displayed to be conditionally...

View Article


In Ruby, how do you set the value for only one specific method argument,...

Th parent_class instance variable for this class has a default value "String". I want to make an instance that has parent_class = "None". My super_string1 instance definition works correctly, but my...

View Article

Pattern matching an array of n items

I'm testing a model in rails, and I'd like to assert that one of the associations has an n items. I've found that the assert_pattern matcher is a pretty good way to do it:assert_pattern do...

View Article

My ruby application calls POST multiple times, how to avoid this?

I a running a model-view-controller application coded in ruby.For whatever reason, on some views where the user selects inputs and finally POST the page contents, I received multiple POST on the...

View Article


Preloading nested Rails associations with a condition without updating models

To provide a simple example, let's say I want to load ALL hospitals for an organization and preload ONLY the doctors that have a calendar, but at the same time, I do not want to create any scopes or...

View Article


Rails: What's a good way to validate links (URLs)?

I was wondering how I would best validate URLs in Rails. I was thinking of using a regular expression, but am not sure if this is the best practice.And, if I were to use a regex, could someone suggest...

View Article

Image may be NSFW.
Clik here to view.

Change the class display after selecting a card with a date in Rails

I'm developing an application for a horsemanship school so they can organize their classes and see who booked a class and whatnot!In the display of all the classes, I've created to help users choose...

View Article

How to find rails route pattern from url

Given a rack request where I know the path, e.g. /things/1, how can I get the route reference e.g. /things/:id?I can use Rails.application.routes.recognize_path to get the controller and action, but...

View Article

Homebrew Portable Ruby Error macOS 10.14.6

Homebrew suddenly stopped working, when i run any brew command i get following output:==> Downloading...

View Article


After updating Cocoapods to 1.13.0 it throws error

I updated CocoaPods to version 1.13.0. Now, when I run pod install, it throws the following error:conversions.rb:108:in '<class:Array>': undefined method 'deprecator' for ActiveSupport:Module...

View Article

Convert degree to radians in ruby

I have a latitude and longitude in degrees and I want to convert these into radians. How can I do that? Any inbuilt method?

View Article


Run kamal setup: Exception while executing on host 192.168.0.1:...

I'm newbie in kamal.It's really a great tool for deployment. Thanks to @dhh .But I have some difficulties deploying despite having read the documentation.After configuring the deploy.yml file like...

View Article

How to dynamically insert translations in JavaScript without the I18n gem in...

In a previous version of my Ruby on Rails application, I was utilizing the I18n gem to manage internationalization, directly embedding translations into JavaScript using code like...

View Article


Ruby 2D array transpose without using built in method

I've been stuck on this for a while. As an assignment I need to transpose this 2D array without using the built in transpose method, and without altering the function name / output. I feel like it...

View Article

CONSULDEMOCRACY: Sass fails (sassc-embeded-import stylesheet not found)

User StoryI am trying to deploy a local instance of consuledemocracy and if fails with Sass::CompileErrorDescriptionMy system is an Ubuntu 22.04 and i use the following versions:Rails v6.1.7.7NodeJS...

View Article

How to verify a webhook with Ruby? (In Rails)

I'm looking to learn how to verify a Paddle webhook with Ruby? Their example has an option on how to do it with PHP, Python and JavaScript, but no Ruby. Any ideas on how to do it? This following old...

View Article
Browsing all 4610 articles
Browse latest View live


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