Category "ruby-on-rails"

Could not open library 'vips.42'; Could not open library 'libvips.42.dylib'

When upgrading from rails 6 to rails 7, and running some ActiveStorage methods locally, I see: Could not open library 'vips.42': dlopen(vips.42, 0x0005): tried:

Simple - using String#scan to extract an email address

I've got a string that contains: @from = "John Doe <[email protected]>" When I do: @from.scan('/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i') I

Have to_json return a mongoid as a string

In my Rails API, I'd like a Mongo object to return as a JSON string with the Mongo UID as an "id" property rather than as an "_id" object. I want my API to ret

What is the send() method used for?

Could someone please help me to understand what the 'send()' method listed below is used for? The code below, when I am reading it, makes no sense what purpose

An error occurred while installing unf_ext (0.0.7.2), and Bundler cannot continue

I was trying to install diaspora into localhost. I removed the Gemfile.lock file and tried bundle install and am seeing this. These are the things I already tr

rspec testing carrierwave

I'm making a rails 3.1 app using carrierwave to upload files to aws s3. I've followed the instructions on the carrierwave github repository and am now able to

ROR + Unable to install tiny_tds

Here I am trying to fetch data from MS-SQL Server 2008 to my Rails application on Ubuntu 10. But I am unable to install tiny_tds. I follow the step given at git

ActiveAdmin still does subquery_for_count even when pagination_total: false

I have a redshift table in the billions of records, lets call it SomeModel. ActiveAdmin.register Redshift::SomeModel do menu parent: 'Redshift' config.filt

uninitialized constant Formtastic::I18n::SCOPES

Rails 6.0.1, Puma 4.3.0, Devise 4.7.1, ActiveAdmin 2.4.0, Formtastic 3.1.5. Once again I am creating a Rails application. Created the foundation. A couple of m

How to set env variables using ASDF in a Rails project

Rbenv uses rbenv-vars to specify per-application environment variables in Rails. Most version managers read the .env file in every project for the environment

How to handle too much logic in the controller vs the models calling each other

I encountered a code design problem while working on a small application. In terms of features, there are a list of tables, each having 2 seats. If two players

How to tell if homebrew is installed on Mac OS X

I am doing some Rails programming and I consistently see Homebrew referenced in solutions around the web but have never used it. I also notice Homebrew in the

How to add roles to rails app from console? Cancan, Devise

I can create user already, but how add roles dynamically? from console or with admin rules? Devise, CanCan. I am new at Rails, but if you will propose me some i

Rails: Turbolinks back to top of page

I am using turbolinks for rails; whenever I click on a link the page scrolls down to the previous page's scroll position. I want all my pages to load such that

Rails 5 belongs_to_required_by_default doesn't work

I use Rails 5.0.0, but for some reason belongs_to_required_by_default doesn't work! Application was created as new rails 5 app class Visit < ApplicationRec

Ubuntu 18.04 can't initialize iptables table `nat', how can I fix this?

I am new to WSL, and I am trying to download prax (Rack Proxy Server for Development). I am using WSL, Ubuntu 18.04 and uname -r -- 4.4.0-19041-Microsoft I am f

Remove associations when using a Factory with associations

I have a simple :item factory with a nested attachment that is working fine. FactoryGirl.define do factory :item do before_create do |item| item.a

Add a CSS class to <%= f.submit %>

My question is easy: <%= f.submit %> Where does the class declaration go? I'm getting errors on multiple attempts.

AssociationTypeMismatch and FactoryGirl

This has been causing some frustration recently... It seems that using Factories in my cucumber tests, in some situations causes AssociationTypeMismatch error

Storing booleans in Active Record Store

I am using a standard rails form to update an ActiveRecord::Store store :settings, accessors: %i[is_public] My form looks like this: <%= form.select(:is_p