RailsCasts Pro episodes are now free!

Learn more or hide this

eriol12's Profile

GitHub User: eriol12

Comments by

Avatar

Yes i am deploying to Heroku. I will check it out. Thanks for the info.

Avatar

How do we go about having redis automatically update caching (development and production) if new products are being added on a regular basis without running

ruby
rake search_suggestions:index

each time a new record is being added in the database?!!

Avatar

we need to add the following like of code:

ActsAsTaggableOn.force_parameterize = true

Avatar

if I use:
save!(validate: false)
the test will pass. Using the above will not validate anything in the send_password_reset method. Is there's any danger of invalid information being saved to the database?!

Avatar

the problem is with send_password_reset method:
def send_password_reset
generate_token(:password_reset_token)
self.password_reset_sent_at = Time.zone.now
save! # this line will raise the exception
UserMailer.password_reset(self).deliver
end

before the method saves it has to set/(leave the same) the :password and :password_confirmation!

how do you do that...?

Avatar

Failures:

1) PasswordResets emails user when requesting password reset
Failure/Error: click_button "Reset Password"
ActiveRecord::RecordInvalid:
Validation failed: Password is too short (minimum is 6 characters), Password confirmation can't be blank
# ./app/models/user.rb:57:in send_password_reset'
# ./app/controllers/password_resets_controller.rb:7:in
create'
# (eval):2:in click_button'
# ./spec/requests/password_resets_spec.rb:9:in
block (2 levels) in '

Finished in 14.17 seconds
167 examples, 1 failure

Failed examples:

rspec ./spec/requests/password_resets_spec.rb:4 # PasswordResets emails user when requesting password reset


On the model user I have the following validations needed for my test unit:
validates :password, length: { minimum: 6 }
validates :password_confirmation, presence: true


Any help how to get the test to pass?!

Avatar

When trying to tag an article, lets say "chemistry, sept 20/2012" as in want to organize all the articles posted on a certain date.
How do you rewrite the routes.rb:
get 'tags/:tag', to: 'articles#index', as: :tag
in order to access tag names that embed "/" forward slash?!
I get this error when I try to access sept 20/2012:
No route matches [GET] "/tags/sept%2020/2012"