All Questions
Tagged with ruby-on-rails forms
5,099
questions
1
vote
1
answer
55
views
Rails: Form that sets up default values for an object?
Say I have an object that has some attributes with default values. I set up the default values for these attributes at a model level like so...
after_initialize :set_defaults
def set_defaults
...
0
votes
0
answers
32
views
Ruby on Rails: File field with stimulus controller breaks when uploading a second file
I have this file field:
<div data-controller="file-upload">
<%= file_field_tag "revision_photos[photo][]",
name: &...
0
votes
1
answer
44
views
form_tag not triggering patch call in rails
Below is the code to update the statuses for different students but the issue is after I am made some changes to the statues clicking update status does nothing.
students/manage_users.html.erb
<div ...
-1
votes
1
answer
43
views
Rails form with custom name not sending correct param to controller
I have a survey form in Rails that loops through questions in a database table and generates a group of radio buttons (answer choices) for each question.
Each group of radio buttons is supposed to ...
0
votes
1
answer
95
views
i can't render partial js from controller rails 7
I've created my_portfolio.html.erb with form submission to controller with remote: true , the controller take the params and verification everything work fine with condition and code, but it's can't ...
0
votes
0
answers
29
views
Split Devise /registrations/edit into separate sections within the same page
Devise's registrations/edit.html.erb allows users to edit their email and password (if any provided). This form also requires current_password to be filled.
I'd like to split this form into separate ...
0
votes
1
answer
41
views
Send / Receive javascript FileList to rails 7 controller (Drag and Drop mode)
I have a form.
<form id="add_content" enctype="multipart/form-data" action="/contents/create" accept-charset="UTF-8" method="post"><input ...
1
vote
1
answer
36
views
Unpermitted Parameter error in Rails for nested nested form submission
I'm trying to create a quiz builder where a user builds a quiz that is added to the Quiz model, a question that is in the QuizQuestions model and answer choices in and AnswerChoices model.
The Quiz is ...
0
votes
1
answer
42
views
Insert parameters in a Devise controller
I am trying to customize a Devise registrations controller for a context where the user cannot enter an email address as their email has been manually entered previously before they can access the ...
1
vote
2
answers
64
views
Rails edit.html.erb form not pre-loading data for inputs with empty select option
I have a rails application that has 2 forms that edit the same table. The first form is in new.html.erb for basic information filled with text fields. Then the second form is edit.html.erb which is ...
0
votes
2
answers
271
views
Can't see full breakdown of multipart/form-data response in Chrome
This question all stemmed from trying to understand why I am not able to get the proper file MimeType in rails. Each file I've sent, csv, pdf, etc... returns type application/octet-stream.
So, I was ...
-1
votes
1
answer
106
views
revalidating rails form errors
lets say I have two validations on rails model: it is necessary to fill both of them: name and title.
validate :name, presence: true
validate :title, presence true
when i submit blank form, error ...
0
votes
2
answers
93
views
Rails form select does not preselect the existing entry
Situation
I am writing a simple rails (a.k.a. no JS) form to create/edit an object in_invoice. One association is called eur_object & can be maintained via a dropdown which is generated via a form....
0
votes
1
answer
88
views
Custom registration forms for different roles using Devise and Rolify on Rails
We're trying to create a conditional statement inside Devise's new registration form so that different fields are shown for different types of roles. The problem is that the role itself should already ...
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: :...