Relative Content

Tag Archive for ruby-on-railsruby

Rails form_with-helper: What is a :scope?

I’m currently reading the Ruby on Raily API-documentation. Specific the part about the form_with helper: https://api.rubyonrails.org/v5.1.7/classes/ActionView/Helpers/FormHelper.html#method-i-form_with

Rails: Extended class that calls another extended class

Setup: We got an initializer (in config/initializers) that requires a file where we define our extensions. This file does something like this: module UbiquoExtensions end :SomeClass.include!(UbiquoExtensions::SomeClass) # Classes that overwrite behaviour need to be fully loaded first <- not my comment, it’s the original developer’s Rails.application.config.after_initialize do AnotherClass.send(:include, UbiquoExtensions::AnotherClass) end extension files look like this: […]

New ruby file can’t load any outside classes

I have a project where I created a new file in an existing directory. This new file is unable to load any classes from outside directories even though an existing file in the same directory is able to load those same classes just fine.

Fetch string only until specific word on ruby

enter image description hereI am building a scraper/parsing method, but the website I am using (https://www.bbcgoodfood.com/search?q=banana)to get the value from have many different informations using the same classes (they have no id, and are in the very same tag). In my case, I just need the preparation time, but it gives me other stuff i don’t need.

What is in-memory database for Ruby on rails

I was asked to develop an application that keeps track of the count of the users created and keep it in a in-memory database and to design it in such way that it is easily changed to a persistent database.

Rails Render JSON Method Seems To Be Removing Type Attribute from Response

I’m using Single Table Inheritance (STI) in my Rails app for the User object. There is an API response that is including all attributes of my User subclasses (Teacher, Student) except for type. I believe this is due to using the render json method, as I was able to find some other questions from a long time ago with this issue, but haven’t found any solutions.