All Questions
1,115
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
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'...
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
votes
2
answers
140
views
Why does Rails sanitize() perform differently in rspec than in a model?
In my config/initializers I added the following to the String class:
class String
def sanitize(options={ tags: %w(div p span strong b em i br ol ul li) })
ActionController::Base.helpers.sanitize(...
0
votes
1
answer
62
views
Duplication on a static page displaying two models
I'm trying to create a static page called Magazine that displays two different models Experiences and Articles ordered by date.
However, I'm running into a strange issue where the Experiences model ...
0
votes
1
answer
50
views
Add Validation for Model creation
I have a Ruby on Rails project with 3 models: User, Group and Task.
The idea is that users can be in different groups and groups can have different users, so member is a table in between connecting ...
0
votes
1
answer
28
views
Rails Uniqueness: true model with a DB with has_many references - Ruby on Rails
I have a problem. I need to set a model of report_templates unique in my database in relation to the classroom, each classroom has only one report_template.
But in my DB, I already have a classroom ...
0
votes
2
answers
95
views
Rspec test case logic for rails
this is my model 'Order' and the 'Order_item' model has association with it
class Order < ApplicationRecord
has_many :order_items
belongs_to :user
before_save :set_subtotal
def ...
0
votes
1
answer
84
views
Call method in model Rails
I have method called check_field, purpose of this method is for checking is there multiple value when input form.
I was think maybe I can check with multiple array on rails. I found some code on this ...
0
votes
1
answer
44
views
Ruby On Rails: Database model Associations
I want to develop a blog application. In which a user can create a post and comment on the post. A post can have many comments from user and it should belong to user. And, same way comment should ...
0
votes
1
answer
166
views
Postman problems in post request
I'm trying to use postman with a post request for mi controller "comments". This rquest show me the following error:
"NoMethodError (undefined method `news'..."
Here is the comment ...
0
votes
2
answers
624
views
Rails best practice for calling a model method from a different controller
I have Model_a, model_a_controller and Model_b. I have a method in model_b that I would like to call in model_a_controller. But I am not sure what the best practice for doing so would be. This is my ...
0
votes
0
answers
52
views
Ruby on Rails rspec validate uniqueness for a belongs to relationship [duplicate]
I created a database where an Artist has many songs. Artist is the name:string. Song is title:string artist:resources. The rspec tests were done with shoulda matchers and I am having trouble ...
0
votes
1
answer
66
views
Chartkick cumulative chart by date never descending
I have a problem with using a cumulative chart with Chartkick.
At the moment, here is how the chart is built in Ruby:
errors = Error.where(status: 'active')
sum = errors.where('first_occurrence_date &...