I have a User model:
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_digest"
end
add_index "users", ["name"], name: "index_users_on_name"
Then, I have the following validation:
class User < ActiveRecord::Base
has_secure_password
validates :password, length: {minimum: 4}
end
Then, I update in my controller the name and email of a certain user:
...
logger.debug('++++++++ new_values after: '+new_values.inspect)
if @user.update_attributes(new_values)
logger.debug('+++++++++++++ SUCCESS')
...
end
(new_values is of type ActionController::Parameters)
My log shows
++++++++ new_values after: {"name"=>"1111", "email"=>"1111"}
However, the update_attributes fails, and the error message says:
Password is too short (minimum is 4 characters)
What I don't understand is, that I don't supply a new password. Why,
then, is password validation triggered here? And how should I implement
this?
Background for this question:
This code is executed only, when a user wants to edit his profile data
(which, for the time being, consist only of name and email). It is
ensured that only a logged in user can execute this code, and only for
his own data. Therefore, I don't require to enter the password. He had
entered it anyway when logging in.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fd05f515f4de339941398f1edba11c56%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
On Thursday, 31 July 2014 18:46:44 UTC-4, Jorge Díaz wrote:
A copule of days ago tris very old request to Google App Engine was marked with a new label and changed status to Acknowledged.https://code.google.com/p/
googleappengine/issues/list?q= label:Language-Ruby Does anyone knows further about this issue?
It creates some expectations o Google finally supporting Ruby on their cloud platform, isn't it?
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d380fee0-d673-4cee-8ab3-d5e0bba92a6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi there,
I'm the Creative Director of In The Dugouts, which is a new football
management game.
Three years ago we started work on the site with a part time developer,
growing to the point where we now have a number of current and
ex-professionals acting as consultants for us on in-game content.
We went full time at the start of the year and have developed a huge
amount of the game including the match engine, team and player
generation. We are looking for a developer / developers on a full time
basis (or part time with reasonable hour commitment per week) may be
acceptable.
We have a great team including a Lead Artist who works in computer games
but has also done special effects for a number of Hollywood films.
We are working with Ruby on Rails, Backbone JS, Bitbucket. We have a
good amount of work left to do so would love to hear from those
interested. You can contact me at asa@inthedugouts.com.
We'd like to hear from those with the relevant experience, details of
your likely preferred hourly commitment per week, desired hourly rate
and availability over the next few months. Preferably an interest /
basic understanding of football would be good but it's not absolutely
necessary.
We look forward to hearing from you.
Asa Jennings
Creative Director
Attachments:
http://www.ruby-forum.com/attachment/9946/2.png
http://www.ruby-forum.com/attachment/9947/3.png
http://www.ruby-forum.com/attachment/9948/4.png
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/88d77546dfb9a695a12d6974ad90393f%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.