All Questions
9 questions
0
votes
2
answers
52
views
Rails: How to error when two strong parameters are sent together at the same time? Allow one of them only
Let's say I accept two different parameters on input: param1 and param2 but I don't allow them to be passed together. How do I error in that case? I need to notify the client they are sending ...
4
votes
2
answers
3k
views
Rails different params in create and update
I have an Event model. And it has budget param. Business logic requires that budget, once set on creation, cannot be changed later.
On client side this means that I disable corresponding field.
But ...
1
vote
1
answer
329
views
Rails presence validation didn't working in params key as array
I got this problem where my test fails because the validation presence: true didn't work. I wonder why it didn't trigger. So, here's the code that I have:
A simple update in controller
def update
...
0
votes
3
answers
520
views
"param is missing or the value is empty:" Paperclip no file selected - Rails
I am building a photo gallery application that allows users to attach multiple photos to each of their galleries. I am using Paperclip to handle file uploads.
The below code works fine until [Upload] ...
0
votes
1
answer
37
views
How to validate associated objects numbers while updating model
Can't understand how to validate associatiated models size while updating main model. In my app product can't have more than 6 attached images. Every image I store in class ProductAttachment
product....
3
votes
3
answers
511
views
Updating Strong Params Only
First of all, I believe there must be some people, who already asked this question before but I don't know how can I google this problem. So, if it is duplicate I am sorry.
I am working on a social ...
6
votes
1
answer
4k
views
Allowing only certain possible values in Rails Strong Parameters
I have a rails app with a user model, which is able to have several roles. I implemented this using a bitmask like this:
class User < ActiveRecord::Base
DEFAULT_ROLES = %w[developer entrepreneur]...
0
votes
2
answers
291
views
Form values not returning after failed validation in Rails 4
I'm using strong parameters in my User controller in my Rails 4 application.
def new
@user = User.new
end
def create
@user = User.new(user_params)
if [email protected]
render :new
...
1
vote
1
answer
864
views
rails validate data and get data using strong parameter
I have 3 tables
User(id,email)
Org(id,name)
Role(id,user_id,org_id,role)
Ajax request send parameters
org[name] test
org[user][email] [email protected]
In my controller
def create
client_org =...