All Questions
Tagged with ruby-on-rails model
3,430
questions
0
votes
1
answer
47
views
Model method not recognizing parameters
I'm building a rails app where users can search through "Playlists", which is an object containing a title, image, and tracks.
I've defined a search method in the Playlist model that takes ...
0
votes
2
answers
80
views
Model VS Active record in ROR
Can somebody please explain me the difference between model and active record in simple words ?
Is active model and model same ?
PS: Knowledge regarding these topics will be appreciated.
I am newbie ...
0
votes
1
answer
44
views
Model validations for specific scenario, Rails
I've using a calendar gem that uses start_time for the date (YYYY-MM-DD).
For example purposes I've got Meeting, which has start_time string and postponed boolean attributes.
@meeting.start_time must ...
0
votes
1
answer
50
views
asset_path helper erroring in method
I am creating a method on my model that I can use to return the URL to the correct logo, photo or a fallback image. My code is:
def image
if photo1.attached?
{ url: photo1.url, alt: "...
0
votes
0
answers
36
views
how to make routes in rails for two models with three relationships
I am developing an application in rails in which I have two models: user and activity. user implements devise.
The situation is that a user can own several activities, can also be part of other ...
0
votes
0
answers
51
views
Rails error Couldn't find User without an ID
I'm stuck in creating a form for editing users in my admin panel. The administrator should be able to edit user roles and delete them, so I created a form but unfortunately I get an error
ActiveRecord:...
1
vote
1
answer
27
views
How to use form_with in Rails for multiple models that don't have controllers
I am trying to create recipe app that users can take. Part of the app is an admin users getting to create the recipes and instructions.
There is a User model/table with all the users. This has a
...
0
votes
1
answer
59
views
Rails attach not working anymore - worked before
Situation
I have a model invoice with an attribute frozenn which handles archiving in my app. Upon archiving a PDF is supposed to get generated and attached (an outbound invoice in my app called ...
1
vote
1
answer
53
views
How would I create a scope using a join that will return only records where all of a has_many relationship read as true (ruby on rails)
I've been trying to write a scope for this model to help filter and find only records where all participants (has_many relationship) have a value for acknowledged_at. The problem I run into is that ...
0
votes
1
answer
95
views
Book.all action displaying empty results
I'm new to Ruby On Rails development, I'm building an API containing the class user, book, author, and shelf. When I call Book.all to retrieve all the books in the Database, I get [] in return and don'...
1
vote
1
answer
30
views
Can my rails gem interact with models defined in the application that the gem is used in?
I have 2 rails applications and there is a service that is used by both. I have refactored the service to be a gem that can be leveraged by both rails applications.
As an example, the service defined ...
3
votes
1
answer
105
views
How to check if a column value is contained within a string
When a payment is received in my company's banking account, a webhook is triggered to our application, providing data related to the payment, including the payment label.
This label is a string ...
1
vote
1
answer
64
views
How comes I get "undefined method `model_name' for {:model=>#<RealQuoteLine ... " when the name is right there?
Can somebody PLEASE explain this to me? I get this error:
NoMethodError in Quotations#work undefined method `model_name' for {:model=>#<RealQuoteLine id: 303, quote_concept: "Exportación ...
1
vote
1
answer
35
views
(Rails) How to create both sides of a friendship from one nested form insert in Rails?
Basically I have a User model, and a Friendship join table to make the Users friends with each other.
class User < ApplicationRecord
has_many :friendships
has_many :friends, through: :...
0
votes
2
answers
29
views
Adding Rails Database Table Column values in ApplicationRecord
I am not so big on Ruby Logic. So i have a Users Table with many portfolios, The portfolios Table has an amount column. I want to add the total amount of for each users portfolio to the users model ...