Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update
- @datum = OtherDatum.friendly.find_or_initialize_by(slug: params[:id]) do |data|
- data.title = params[:other_datum][:title]
- data.number = params[:other_datum][:number]
- data.roles = params[:other_datum][:roles]
- end
- byebug
- # if @datum.update(other_datum_params.merge(slug: params[:id]))
- if @datum.valid?
- # @datum.save
- # redirect_to({:action => :index}, {:notice => 'Data updated'})
- else
- # puts @datum.object_id
- byebug
- render :edit
- end
- end
- def other_datum_params
- params.require(:other_datum).permit(:title, :number, :roles, :slug)
- end
- Log:
- [22, 31] in /home/usr/Dropbox/tech/tech/app/controllers/admin/other_data_controller.rb
- 22: data.number = params[:other_datum][:number]
- 23: data.roles = params[:other_datum][:roles]
- 24: end
- 25: byebug
- 26: # if @datum.update(other_datum_params.merge(slug: params[:id]))
- => 27: if @datum.valid?
- 28: # @datum.save
- 29: # redirect_to({:action => :index}, {:notice => 'Data updated'})
- 30: else
- 31: # puts @datum.object_id
- (byebug) @datum
- #<OtherDatum id: nil, title: "Тест", number: nil, created_at: nil, updated_at: nil, slug: "satellite", roles: [""]>
- (byebug) c
- [28, 37] in /home/usr/Dropbox/tech/tech/app/controllers/admin/other_data_controller.rb
- 28: # @datum.save
- 29: # redirect_to({:action => :index}, {:notice => 'Data updated'})
- 30: else
- 31: # puts @datum.object_id
- 32: byebug
- => 33: render :edit
- 34: end
- 35: end
- 36:
- 37: def other_datum_params
- (byebug) @datum
- #<OtherDatum id: nil, title: "Тест", number: nil, created_at: nil, updated_at: nil, slug: nil, roles: [""]>
- (byebug) I, [2020-02-28T17:09:56.302596 #5738] INFO -- : SIGWINCH ignored because we're not daemonized
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement