astopo/book-orbit

NoMethodError in UserController#edit

Closed this issue · 2 comments

Tried adding: https://gist.github.com/kvirani/5dd7e651887c4994e2e3

undefined method `truncate' for nil:NilClass

Extracted source (around line #30):
28
29
30
31
32
33

end

def get_desc(page) page.xpath('//meta[@name="description"]/@content').map(&:value).first.truncate(200)
end

end

Rails.root: /home/bookorb/public_html

Application Trace | Framework Trace | Full Trace
app/helpers/user_helper.rb:30:in get_desc' app/controllers/user_controller.rb:75:inadd_bookmark'
app/controllers/user_controller.rb:56:in `edit'
Request

Parameters:

{"utf8"=>"✓",
"authenticity_token"=>"tkT7jfF7siCAcBzDNhogr/AGxwEwzk7gASk1iYd/o00=",
"add_bookmark"=>"true",
"url"=>"https://gist.github.com/kvirani/5dd7e651887c4994e2e3",
"collection"=>["Ruby"],
"commit"=>"+ Add",
"username"=>"xianny"}
Toggle session dump
Toggle env dump
Response

Headers:

None

Hi Xianny, thanks for posting! I have seen this same issue a few times a well. Just a heads up, this is the repo for the Sinatra version. The current version in production is in Rails, the repo for that is here: https://github.com/astopo/book-orbit-rails/issues

Thanks again!

Fixed.