Simon Moro


1,020 Experience
2 Lessons Completed
1 Question Solved


Actually... it seems it is auo loading them into the test environment... So, consider this closed :)


Is there a way to create a fixture for a model that is not in the database? I built my app a few years back following a guide in which the Plans were loaded from a YML file and instantiated as ActiveRecord models, but not persisted in the database.

When I attempt to create the fixtures for Plans, I get:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "plans" does not exist

Because, of course, there IS no table for plans.

However, I still need the Plan model available in my tests.

Thanks in advance!

Here the app code - which works... Just need to create fixtures :)

plan_loader.rb - initializer

file_path = "config/plans.yml"
if File.exist?(file_path)
PLANS = YAML.load(

plan.rb - model

class Plan
def self.plans
@plans ||= { |k| PLANS[k] }

def self.all { |plan| }

def self.where(args)
conditions = do |arg_key, arg_val|
proc { |plan| plan[arg_key] == arg_val }
local_plans = { |plan| conditions.all? { |c| } } { |plan| }

def self.find(stripe_id)
plan = plans.find { |p| p[:stripe_id] == stripe_id }

Posted in How to get started?


I'm unsure which videos on here would be a good place to start, but if you're new to Rails, I think learning the fundamentals of its magic would be valuable. Have you been programming in Ruby for a while? Or other languages?

When I first learned Rails, I lacked an understanding of what was Ruby, and what was Rails... Learning pure Ruby, was a game-changer for me... Then I learned about how Rails works... Even simple things like the controller action will automatically render a view with the same name unless otherwise specified...

Maybe Chris would be able to point you in the right direction to some 'build simple a app' videos... Then come back here for the complex, cool stuff!?

Posted in Incorrect Content-Type Response Headers


What's the context? I found with one of my apps, mp3 files were being uploaded to the server with different content-types... It turned out the OS and the browser was affecting them... On one computer it may upload as 'audio/mp3' on another the exact same file uploaded as 'audio/mpeg3'...

Is this being set on upload?

Hi there!

I'd love to know if there's a straightforward way of implementing S3 accelerated uploads for certain users, with ActiveStorage. Essentially, I want my paid users to experience faster uploads.

I can see turning it on globally is easy in config: use_accelerate_endpoint: true

Any assistance in finding a way to set it dynamically would be greatly appreciated!

Thanks :)

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.