Rails keep rejecting string params as enumA concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?How to drop columns using Rails migrationDifference between string and text in rails?Ruby on Rails Server optionsPurge or recreate a Ruby on Rails databaseRails params explained?How to use concerns in Rails 4
Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?
How long do you think advanced cybernetic implants would plausibly last?
When, exactly, does the Rogue Scout get to use their Skirmisher ability?
How do I prevent other wifi networks from showing up on my computer?
Round towards zero
Are there any elected officials in the U.S. who are not legislators, judges, or constitutional officers?
How many lines of code does the original TeX contain?
To get so rich that you are not in need of anymore money
When one problem is added to the previous one
How is linear momentum conserved in case of a freely falling body?
Evaluated vs. unevaluated Association
How can I download a file through 2 SSH connections?
about to retire but not retired yet, employed but not working any more
Rent contract say that pets are not allowed. Possible repercussions if bringing the pet anyway?
How to respectfully refuse to assist co-workers with IT issues?
Does ostensible/specious make sense in this sentence?
How to send bitcoin from an offline Bitcoin Core that doesn't have a synced balance?
Command "root" and "subcommands"
How does encoder decoder network works?
Removal of て in Japanese novels
What is a natural problem in theory of computation?
“T” in subscript in formulas
Prevent use of CNAME record for untrusted domain
Why is there a difference between predicting on Validation set and Test set?
Rails keep rejecting string params as enum
A concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?How to drop columns using Rails migrationDifference between string and text in rails?Ruby on Rails Server optionsPurge or recreate a Ruby on Rails databaseRails params explained?How to use concerns in Rails 4
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am submeting my params from the front end and this is what is reaching my back end
Started PUT "/api/admin/deputados_perfis/50" for 127.0.0.1 at 2019-03-27 18:38:49 +0000
Parameters: "deputado"=>"id"=>"50", "nome"=>"Ademir Menezes", "ativo"=>"false", "sexo_feminino"=>"false", "partido"=>"PSD", "deputado_rede_social_attributes"=>"0"=>"$$hashKey"=>"object:76", "tipo"=>"youtube", "conteudo"=>"14515414515", "deputado_perfil_attributes"=>"id"=>"239", "deputado_id"=>"50", "nome_completo"=>"khjkghjkfj", "biografia"=>"utotuiyuiytiittyiutyi", "site"=>"", "telefones"=>"", "gabinete"=>"", "created_at"=>"2019-03-27T14:54:35.792-03:00", "updated_at"=>"2019-03-27T14:55:23.388-03:00", "id"=>"50"
But my server rejects the update because 'youtube' is not a valid tipo
I am using Rails 5.1.4 and Ruby 2.3.7
My relevant methods
module Api
module Admin
class DeputadosPerfisController < Api::Admin::PrivateController
before_action :set_deputado, only: %i[show edit update destroy]
def update
@deputado.update(deputado_params)
@mensagem = 'Perfil do deputado criado com sucesso'
render json: mensagem: @mensagem, codigo: 1, deputado_id: @deputado.id , status: 201
end
private
def set_deputado
@deputado = ::AlegoShared::Public::Deputado.includes(:deputado_perfil, :deputado_rede_social).find params[:id]
end
def deputado_params
params.require(:deputado).permit(:id, deputado_perfil_attributes: [:id, :nome_completo, :biografia, :site, :foto, :gabinete, :telefones, :deputado_id],
deputado_rede_social_attributes: [:id, :tipo, :conteudo, :deputado_id])
end
end
end
end
My table in schema
create_table "deputado_rede_sociais", force: :cascade do |t|
t.integer "deputado_id", null: false
t.string "conteudo", null: false
t.integer "tipo", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deputado_id"], name: "idx_deputado_rede_sociais_deputados"
end
My Model
module Portal
class DeputadoRedeSocial < ApplicationRecord
enum tipo: [:email, :facebook, :instagram, :youtube, :twitter, :outros]
validates_presence_of :deputado_id, :conteudo, :tipo
end
end
My view snippet
<h3>Redes sociais</h3>
<div ng-repeat="redeSocial in vm.deputado.deputado_rede_social">
<label show-erros class="field-12 form-texto">
<span class="label">Tipo de rede social</span>
<select name="ano" ng-model="redeSocial.tipo" ng-options="obj.key as obj.value for obj in vm.tiposRedeSocial track by obj.key" ng-required="true">
<option disabled value="">Selecione</option>
</select>
<div ng-messages="vm.form.redeSocial.tipo.$error" class="form--erro__bloco">
<div ng-message="required">Tipo de rede social é obrigatória.</div>
</div>
</label>
<label show-erros class="field-12 form-texto">
<span class="label">Endereço</span>
<input name="biografia" ng-model="redeSocial.conteudo" ng-required="true" autocomplete="off" />
<div ng-messages="vm.form.data.$error" class="form--erro__bloco">
<div ng-message="required">Conteúdo é obrigatório.</div>
</div>
</label>
<a ng-click="vm.removerRedeSocial">Remover rede social</a>
</div>
<a ng-click="vm.adicionarRedeSocial()">Adicionar rede social</a>
My controller from AngularJS
;(function ()
'use strict'
angular.module('app.admin.deputados')
.controller('DeputadosFormController', DeputadosFormController)
DeputadosFormController.$inject = ['$state', '$scope', 'deputado', 'tipos', 'SweetAlert', '$stateParams', 'toastr']
function DeputadosFormController ($state, $scope, deputado, tipos, SweetAlert, $stateParams, toastr)
var vm = this
vm.deputado = deputado
vm.salvar = salvar
vm.adicionarRedeSocial = adicionarRedeSocial
function adicionarRedeSocial ()
vm.deputado.deputado_rede_social.push()
function salvar ()
$scope.$broadcast('show-errors-check-validity')
if (vm.form.$valid)
vm.deputado['deputado_rede_social_attributes'] = vm.deputado['deputado_rede_social']
vm.deputado['deputado_perfil_attributes'] = vm.deputado['deputado_perfil']
delete vm.deputado['deputado_rede_social']
delete vm.deputado['deputado_perfil']
vm.deputado.$update().then(function (result) , function (error)
toastr.error(error.data.mensagem)
)
else
toastr.error('Preencha todos os campos obrigatórios')
)()
My dataservice
;(function () {
'use strict'
angular.module('app.base.admin')
.factory('AdminDeputadosDataService', ['$resource', 'transformToFormData', function ($resource, transformToFormData)
var resource = $resource(
API_HOST + '/api/admin/deputados_perfis/:id',
id: '@id' ,
update:
method: 'PUT',
transformRequest: function (data)
return transformToFormData.transform('deputado', data)
,
headers: 'Content-Type': undefined
,
query:
isArray: true,
interceptor:
response: function (response)
response.resource.$totalLinhas = response.headers('TotalLinhas')
return response.resource
,
return resource
])
)()
I am expecting to save my record.
ruby-on-rails angularjs activerecord
add a comment |
I am submeting my params from the front end and this is what is reaching my back end
Started PUT "/api/admin/deputados_perfis/50" for 127.0.0.1 at 2019-03-27 18:38:49 +0000
Parameters: "deputado"=>"id"=>"50", "nome"=>"Ademir Menezes", "ativo"=>"false", "sexo_feminino"=>"false", "partido"=>"PSD", "deputado_rede_social_attributes"=>"0"=>"$$hashKey"=>"object:76", "tipo"=>"youtube", "conteudo"=>"14515414515", "deputado_perfil_attributes"=>"id"=>"239", "deputado_id"=>"50", "nome_completo"=>"khjkghjkfj", "biografia"=>"utotuiyuiytiittyiutyi", "site"=>"", "telefones"=>"", "gabinete"=>"", "created_at"=>"2019-03-27T14:54:35.792-03:00", "updated_at"=>"2019-03-27T14:55:23.388-03:00", "id"=>"50"
But my server rejects the update because 'youtube' is not a valid tipo
I am using Rails 5.1.4 and Ruby 2.3.7
My relevant methods
module Api
module Admin
class DeputadosPerfisController < Api::Admin::PrivateController
before_action :set_deputado, only: %i[show edit update destroy]
def update
@deputado.update(deputado_params)
@mensagem = 'Perfil do deputado criado com sucesso'
render json: mensagem: @mensagem, codigo: 1, deputado_id: @deputado.id , status: 201
end
private
def set_deputado
@deputado = ::AlegoShared::Public::Deputado.includes(:deputado_perfil, :deputado_rede_social).find params[:id]
end
def deputado_params
params.require(:deputado).permit(:id, deputado_perfil_attributes: [:id, :nome_completo, :biografia, :site, :foto, :gabinete, :telefones, :deputado_id],
deputado_rede_social_attributes: [:id, :tipo, :conteudo, :deputado_id])
end
end
end
end
My table in schema
create_table "deputado_rede_sociais", force: :cascade do |t|
t.integer "deputado_id", null: false
t.string "conteudo", null: false
t.integer "tipo", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deputado_id"], name: "idx_deputado_rede_sociais_deputados"
end
My Model
module Portal
class DeputadoRedeSocial < ApplicationRecord
enum tipo: [:email, :facebook, :instagram, :youtube, :twitter, :outros]
validates_presence_of :deputado_id, :conteudo, :tipo
end
end
My view snippet
<h3>Redes sociais</h3>
<div ng-repeat="redeSocial in vm.deputado.deputado_rede_social">
<label show-erros class="field-12 form-texto">
<span class="label">Tipo de rede social</span>
<select name="ano" ng-model="redeSocial.tipo" ng-options="obj.key as obj.value for obj in vm.tiposRedeSocial track by obj.key" ng-required="true">
<option disabled value="">Selecione</option>
</select>
<div ng-messages="vm.form.redeSocial.tipo.$error" class="form--erro__bloco">
<div ng-message="required">Tipo de rede social é obrigatória.</div>
</div>
</label>
<label show-erros class="field-12 form-texto">
<span class="label">Endereço</span>
<input name="biografia" ng-model="redeSocial.conteudo" ng-required="true" autocomplete="off" />
<div ng-messages="vm.form.data.$error" class="form--erro__bloco">
<div ng-message="required">Conteúdo é obrigatório.</div>
</div>
</label>
<a ng-click="vm.removerRedeSocial">Remover rede social</a>
</div>
<a ng-click="vm.adicionarRedeSocial()">Adicionar rede social</a>
My controller from AngularJS
;(function ()
'use strict'
angular.module('app.admin.deputados')
.controller('DeputadosFormController', DeputadosFormController)
DeputadosFormController.$inject = ['$state', '$scope', 'deputado', 'tipos', 'SweetAlert', '$stateParams', 'toastr']
function DeputadosFormController ($state, $scope, deputado, tipos, SweetAlert, $stateParams, toastr)
var vm = this
vm.deputado = deputado
vm.salvar = salvar
vm.adicionarRedeSocial = adicionarRedeSocial
function adicionarRedeSocial ()
vm.deputado.deputado_rede_social.push()
function salvar ()
$scope.$broadcast('show-errors-check-validity')
if (vm.form.$valid)
vm.deputado['deputado_rede_social_attributes'] = vm.deputado['deputado_rede_social']
vm.deputado['deputado_perfil_attributes'] = vm.deputado['deputado_perfil']
delete vm.deputado['deputado_rede_social']
delete vm.deputado['deputado_perfil']
vm.deputado.$update().then(function (result) , function (error)
toastr.error(error.data.mensagem)
)
else
toastr.error('Preencha todos os campos obrigatórios')
)()
My dataservice
;(function () {
'use strict'
angular.module('app.base.admin')
.factory('AdminDeputadosDataService', ['$resource', 'transformToFormData', function ($resource, transformToFormData)
var resource = $resource(
API_HOST + '/api/admin/deputados_perfis/:id',
id: '@id' ,
update:
method: 'PUT',
transformRequest: function (data)
return transformToFormData.transform('deputado', data)
,
headers: 'Content-Type': undefined
,
query:
isArray: true,
interceptor:
response: function (response)
response.resource.$totalLinhas = response.headers('TotalLinhas')
return response.resource
,
return resource
])
)()
I am expecting to save my record.
ruby-on-rails angularjs activerecord
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
youtube
is not a validtipo
fordeputado_rede_social
. You either have a validation in theDeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for thetipo
column.
– fanta
Mar 27 at 19:03
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
I just added my view code
– Júlio Campos
Mar 28 at 17:00
add a comment |
I am submeting my params from the front end and this is what is reaching my back end
Started PUT "/api/admin/deputados_perfis/50" for 127.0.0.1 at 2019-03-27 18:38:49 +0000
Parameters: "deputado"=>"id"=>"50", "nome"=>"Ademir Menezes", "ativo"=>"false", "sexo_feminino"=>"false", "partido"=>"PSD", "deputado_rede_social_attributes"=>"0"=>"$$hashKey"=>"object:76", "tipo"=>"youtube", "conteudo"=>"14515414515", "deputado_perfil_attributes"=>"id"=>"239", "deputado_id"=>"50", "nome_completo"=>"khjkghjkfj", "biografia"=>"utotuiyuiytiittyiutyi", "site"=>"", "telefones"=>"", "gabinete"=>"", "created_at"=>"2019-03-27T14:54:35.792-03:00", "updated_at"=>"2019-03-27T14:55:23.388-03:00", "id"=>"50"
But my server rejects the update because 'youtube' is not a valid tipo
I am using Rails 5.1.4 and Ruby 2.3.7
My relevant methods
module Api
module Admin
class DeputadosPerfisController < Api::Admin::PrivateController
before_action :set_deputado, only: %i[show edit update destroy]
def update
@deputado.update(deputado_params)
@mensagem = 'Perfil do deputado criado com sucesso'
render json: mensagem: @mensagem, codigo: 1, deputado_id: @deputado.id , status: 201
end
private
def set_deputado
@deputado = ::AlegoShared::Public::Deputado.includes(:deputado_perfil, :deputado_rede_social).find params[:id]
end
def deputado_params
params.require(:deputado).permit(:id, deputado_perfil_attributes: [:id, :nome_completo, :biografia, :site, :foto, :gabinete, :telefones, :deputado_id],
deputado_rede_social_attributes: [:id, :tipo, :conteudo, :deputado_id])
end
end
end
end
My table in schema
create_table "deputado_rede_sociais", force: :cascade do |t|
t.integer "deputado_id", null: false
t.string "conteudo", null: false
t.integer "tipo", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deputado_id"], name: "idx_deputado_rede_sociais_deputados"
end
My Model
module Portal
class DeputadoRedeSocial < ApplicationRecord
enum tipo: [:email, :facebook, :instagram, :youtube, :twitter, :outros]
validates_presence_of :deputado_id, :conteudo, :tipo
end
end
My view snippet
<h3>Redes sociais</h3>
<div ng-repeat="redeSocial in vm.deputado.deputado_rede_social">
<label show-erros class="field-12 form-texto">
<span class="label">Tipo de rede social</span>
<select name="ano" ng-model="redeSocial.tipo" ng-options="obj.key as obj.value for obj in vm.tiposRedeSocial track by obj.key" ng-required="true">
<option disabled value="">Selecione</option>
</select>
<div ng-messages="vm.form.redeSocial.tipo.$error" class="form--erro__bloco">
<div ng-message="required">Tipo de rede social é obrigatória.</div>
</div>
</label>
<label show-erros class="field-12 form-texto">
<span class="label">Endereço</span>
<input name="biografia" ng-model="redeSocial.conteudo" ng-required="true" autocomplete="off" />
<div ng-messages="vm.form.data.$error" class="form--erro__bloco">
<div ng-message="required">Conteúdo é obrigatório.</div>
</div>
</label>
<a ng-click="vm.removerRedeSocial">Remover rede social</a>
</div>
<a ng-click="vm.adicionarRedeSocial()">Adicionar rede social</a>
My controller from AngularJS
;(function ()
'use strict'
angular.module('app.admin.deputados')
.controller('DeputadosFormController', DeputadosFormController)
DeputadosFormController.$inject = ['$state', '$scope', 'deputado', 'tipos', 'SweetAlert', '$stateParams', 'toastr']
function DeputadosFormController ($state, $scope, deputado, tipos, SweetAlert, $stateParams, toastr)
var vm = this
vm.deputado = deputado
vm.salvar = salvar
vm.adicionarRedeSocial = adicionarRedeSocial
function adicionarRedeSocial ()
vm.deputado.deputado_rede_social.push()
function salvar ()
$scope.$broadcast('show-errors-check-validity')
if (vm.form.$valid)
vm.deputado['deputado_rede_social_attributes'] = vm.deputado['deputado_rede_social']
vm.deputado['deputado_perfil_attributes'] = vm.deputado['deputado_perfil']
delete vm.deputado['deputado_rede_social']
delete vm.deputado['deputado_perfil']
vm.deputado.$update().then(function (result) , function (error)
toastr.error(error.data.mensagem)
)
else
toastr.error('Preencha todos os campos obrigatórios')
)()
My dataservice
;(function () {
'use strict'
angular.module('app.base.admin')
.factory('AdminDeputadosDataService', ['$resource', 'transformToFormData', function ($resource, transformToFormData)
var resource = $resource(
API_HOST + '/api/admin/deputados_perfis/:id',
id: '@id' ,
update:
method: 'PUT',
transformRequest: function (data)
return transformToFormData.transform('deputado', data)
,
headers: 'Content-Type': undefined
,
query:
isArray: true,
interceptor:
response: function (response)
response.resource.$totalLinhas = response.headers('TotalLinhas')
return response.resource
,
return resource
])
)()
I am expecting to save my record.
ruby-on-rails angularjs activerecord
I am submeting my params from the front end and this is what is reaching my back end
Started PUT "/api/admin/deputados_perfis/50" for 127.0.0.1 at 2019-03-27 18:38:49 +0000
Parameters: "deputado"=>"id"=>"50", "nome"=>"Ademir Menezes", "ativo"=>"false", "sexo_feminino"=>"false", "partido"=>"PSD", "deputado_rede_social_attributes"=>"0"=>"$$hashKey"=>"object:76", "tipo"=>"youtube", "conteudo"=>"14515414515", "deputado_perfil_attributes"=>"id"=>"239", "deputado_id"=>"50", "nome_completo"=>"khjkghjkfj", "biografia"=>"utotuiyuiytiittyiutyi", "site"=>"", "telefones"=>"", "gabinete"=>"", "created_at"=>"2019-03-27T14:54:35.792-03:00", "updated_at"=>"2019-03-27T14:55:23.388-03:00", "id"=>"50"
But my server rejects the update because 'youtube' is not a valid tipo
I am using Rails 5.1.4 and Ruby 2.3.7
My relevant methods
module Api
module Admin
class DeputadosPerfisController < Api::Admin::PrivateController
before_action :set_deputado, only: %i[show edit update destroy]
def update
@deputado.update(deputado_params)
@mensagem = 'Perfil do deputado criado com sucesso'
render json: mensagem: @mensagem, codigo: 1, deputado_id: @deputado.id , status: 201
end
private
def set_deputado
@deputado = ::AlegoShared::Public::Deputado.includes(:deputado_perfil, :deputado_rede_social).find params[:id]
end
def deputado_params
params.require(:deputado).permit(:id, deputado_perfil_attributes: [:id, :nome_completo, :biografia, :site, :foto, :gabinete, :telefones, :deputado_id],
deputado_rede_social_attributes: [:id, :tipo, :conteudo, :deputado_id])
end
end
end
end
My table in schema
create_table "deputado_rede_sociais", force: :cascade do |t|
t.integer "deputado_id", null: false
t.string "conteudo", null: false
t.integer "tipo", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deputado_id"], name: "idx_deputado_rede_sociais_deputados"
end
My Model
module Portal
class DeputadoRedeSocial < ApplicationRecord
enum tipo: [:email, :facebook, :instagram, :youtube, :twitter, :outros]
validates_presence_of :deputado_id, :conteudo, :tipo
end
end
My view snippet
<h3>Redes sociais</h3>
<div ng-repeat="redeSocial in vm.deputado.deputado_rede_social">
<label show-erros class="field-12 form-texto">
<span class="label">Tipo de rede social</span>
<select name="ano" ng-model="redeSocial.tipo" ng-options="obj.key as obj.value for obj in vm.tiposRedeSocial track by obj.key" ng-required="true">
<option disabled value="">Selecione</option>
</select>
<div ng-messages="vm.form.redeSocial.tipo.$error" class="form--erro__bloco">
<div ng-message="required">Tipo de rede social é obrigatória.</div>
</div>
</label>
<label show-erros class="field-12 form-texto">
<span class="label">Endereço</span>
<input name="biografia" ng-model="redeSocial.conteudo" ng-required="true" autocomplete="off" />
<div ng-messages="vm.form.data.$error" class="form--erro__bloco">
<div ng-message="required">Conteúdo é obrigatório.</div>
</div>
</label>
<a ng-click="vm.removerRedeSocial">Remover rede social</a>
</div>
<a ng-click="vm.adicionarRedeSocial()">Adicionar rede social</a>
My controller from AngularJS
;(function ()
'use strict'
angular.module('app.admin.deputados')
.controller('DeputadosFormController', DeputadosFormController)
DeputadosFormController.$inject = ['$state', '$scope', 'deputado', 'tipos', 'SweetAlert', '$stateParams', 'toastr']
function DeputadosFormController ($state, $scope, deputado, tipos, SweetAlert, $stateParams, toastr)
var vm = this
vm.deputado = deputado
vm.salvar = salvar
vm.adicionarRedeSocial = adicionarRedeSocial
function adicionarRedeSocial ()
vm.deputado.deputado_rede_social.push()
function salvar ()
$scope.$broadcast('show-errors-check-validity')
if (vm.form.$valid)
vm.deputado['deputado_rede_social_attributes'] = vm.deputado['deputado_rede_social']
vm.deputado['deputado_perfil_attributes'] = vm.deputado['deputado_perfil']
delete vm.deputado['deputado_rede_social']
delete vm.deputado['deputado_perfil']
vm.deputado.$update().then(function (result) , function (error)
toastr.error(error.data.mensagem)
)
else
toastr.error('Preencha todos os campos obrigatórios')
)()
My dataservice
;(function () {
'use strict'
angular.module('app.base.admin')
.factory('AdminDeputadosDataService', ['$resource', 'transformToFormData', function ($resource, transformToFormData)
var resource = $resource(
API_HOST + '/api/admin/deputados_perfis/:id',
id: '@id' ,
update:
method: 'PUT',
transformRequest: function (data)
return transformToFormData.transform('deputado', data)
,
headers: 'Content-Type': undefined
,
query:
isArray: true,
interceptor:
response: function (response)
response.resource.$totalLinhas = response.headers('TotalLinhas')
return response.resource
,
return resource
])
)()
I am expecting to save my record.
ruby-on-rails angularjs activerecord
ruby-on-rails angularjs activerecord
edited Mar 28 at 17:00
Júlio Campos
asked Mar 27 at 18:45
Júlio CamposJúlio Campos
407 bronze badges
407 bronze badges
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
youtube
is not a validtipo
fordeputado_rede_social
. You either have a validation in theDeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for thetipo
column.
– fanta
Mar 27 at 19:03
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
I just added my view code
– Júlio Campos
Mar 28 at 17:00
add a comment |
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
youtube
is not a validtipo
fordeputado_rede_social
. You either have a validation in theDeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for thetipo
column.
– fanta
Mar 27 at 19:03
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
I just added my view code
– Júlio Campos
Mar 28 at 17:00
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
youtube
is not a valid tipo
for deputado_rede_social
. You either have a validation in the DeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for the tipo
column.– fanta
Mar 27 at 19:03
youtube
is not a valid tipo
for deputado_rede_social
. You either have a validation in the DeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for the tipo
column.– fanta
Mar 27 at 19:03
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
I just added my view code
– Júlio Campos
Mar 28 at 17:00
I just added my view code
– Júlio Campos
Mar 28 at 17:00
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384465%2frails-keep-rejecting-string-params-as-enum%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384465%2frails-keep-rejecting-string-params-as-enum%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you show us your schema for this model and the form that sends these params?
– Veridian Dynamics
Mar 27 at 18:56
youtube
is not a validtipo
fordeputado_rede_social
. You either have a validation in theDeputadoRedeSocial
model or your table definition does not allow that(youtube
) value for thetipo
column.– fanta
Mar 27 at 19:03
I just added my schema and model. I have youtube as enum value.
– Júlio Campos
Mar 27 at 19:05
It's almost definitely a problem in your form! (i.e. HTML)
– Veridian Dynamics
Mar 27 at 21:03
I just added my view code
– Júlio Campos
Mar 28 at 17:00