RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: sjahandideh
Hi Ryan, Thanks for this great episode. In your submit code:
def submit(params) .... if valid? @user.password = new_password @user.save! true else false end end
I think you better use @user.save instead of save!. The reason is that your submit method can then only return true or false:
if valid? @user.password = new_password @user.save else false end
As someone who reads your code, i dont expect to see user validation errors on password submit method.
Thank you for the useful episodes Ryan.
I found it cleaner to use haml_coffee_assets as the template engine as you don't need to write your Html code using javascript. and you can simply use coffeescript inside your haml templates :)
Hi Ryan, Thanks for this great episode. In your submit code:
I think you better use @user.save instead of save!. The reason is that your submit method can then only return true or false:
As someone who reads your code, i dont expect to see user validation errors on password submit method.
Thank you for the useful episodes Ryan.
I found it cleaner to use haml_coffee_assets as the template engine as you don't need to write your Html code using javascript. and you can simply use coffeescript inside your haml templates :)