All Questions
Tagged with ruby-on-rails-7 ruby
264
questions
1
vote
1
answer
81
views
ActiveRecord::NotNullViolation: RuntimeError: NOT NULL constraint failed: drives.created_at
I am using latest ruby 3.3.3 and latest rails 7.1.3.4.
I am new to rails and I am learning it. Sorry if my request seems dumb to some.
I got this error when I run tests.
It seems that ActiveRecord is ...
1
vote
1
answer
82
views
Paste multi lines in Rails console with pry
Problem: I cannot paste multi-line code as pry tries to execute every line.
Expected behavior:
[1] pry(main)> %w[a b c]
.map(&:to_sym)
=> [:a, :b, :c]
[2] pry(main)>
Actual behavior:
[1] ...
1
vote
1
answer
33
views
Rails controller doesn’t render any templates
I have a question about a rails 7 project I’m starting. I have a controller HomeController with one action home.
class HomeController < ApplicationController
def home
render
end
end
I have ...
0
votes
1
answer
49
views
Rails app not updating page when in responsive mode
I have an app built using Ruby 3.3, Rails 7 with import map and dart-sass for my asset-pipeline, the application uses bootstrap for css and coreui\coreui-admin as FE template.
Saying that my error is ...
1
vote
1
answer
58
views
Ruby On Rails - Turn If Else Statement Wiith Match? To Case Statement
How do I turn the following if / else statement:
if /_?town$/.match? name
['Springfield', 'Shelbyville', 'Kent', 'Carter', 'Benson'].sample
elsif /_?state$/.match? name
['TX'].sample
...
1
vote
2
answers
69
views
Rails Associated Child Model
I am trying to follow the rails getting started guide to set up my project, but am running into an issue with setting up the nested models/controllers/views.
I have Activity model and Refusal model, ...
1
vote
1
answer
64
views
Rails Exception No Such Table Exists
I used rails generate to scaffold a ProjectType table and a ProjectGroup table that references project type. I created a project type successfully through the browser, but when trying to create the ...
0
votes
1
answer
99
views
Pagy gem: best practice to paginate a collection that comes from the model's has_many association
In my Rails 7.1 app I have two models: Movie and Director coupled together with the many-to-many association, so I can call e.g. Director.all[index].movies to get all movies associated with this ...
0
votes
0
answers
47
views
How to create records via FactoryBot with microservice app
I'm new to microservices, always worked with monoliths. I have an application with microservice architecture. The database is located in the part of app in a gem and is accessed through:
...
0
votes
2
answers
56
views
Rails 7: How to include a nested assosiation in a jsonapi-serializer
I have an author that has many books and a book that belongs to an author in an rails 7 api. I am using "jsonapi-serializer", "~> 2.2" to try and get the author and their books. ...
1
vote
1
answer
247
views
Getting bootsnap error when using 3.3.1 ruby versions
I am updating ruby version from 3.0.6 to 3.3.1 and bundle run successfully but when try to run rails server or rails c ,getting this error
**"**ArgumentError: comparison of String with nil failed ...
-1
votes
1
answer
75
views
Rspec on Docker with database_cleaner causes remote URL error: RemoteDatabaseUrl
I'm working in Docker, trying to run bundle exec rspec ./spec/services/something/something_spec.rb and I am getting this error
DatabaseCleaner::Safeguard::Error::RemoteDatabaseUrl:
ENV['DATABASE_URL'] ...
0
votes
1
answer
33
views
rollback database in local doesn't update postgres in server Rails 7
I'm running Rails 7 on my server, even though when I add a new table, it does migrate and I can see it in the server database. But when I made changes by rolling back in development environment, and ...
1
vote
0
answers
98
views
Getting randomly PG::Error: can't open large object with rails application
I have a rails application using postgresql 16, i am using latest version 1.5.6 of pg gem.
I have the below method:-
def file_length
transaction do
lo = active_connection.lo_open(self.oid, ...
2
votes
2
answers
101
views
Rails: nested namespace produces a weird path to a partial, resulting a MissingTemplate error
I have an ActiveRecord model named Book, and a model named Book::Author. An author has many books through the Book::Authorship model (one-to-many association).
Off-topic:
In my app only ...