ruby on rails - Store URL to image directly in DB (without Carrierwave uploader) -
i'm developing application ruby on rails utilize carrierwave-gem. if take image computer , save model, works expected.
but now, want store images-url straight in db without using carrierwave @ (also no remote upload). want store image-url external api in field store image (with help of carrierwave).
here's current approach, fails store image-url:
def create_with_api @job = job.friendly.find(request.env['omniauth.params']['job_id']) auth = request.env['omniauth.auth'] @applicant = @job.applicants.new( is_male: auth.extra.raw_info.gender == 'm' ? true : false, first_name: auth.extra.raw_info.first_name, last_name: auth.extra.raw_info.last_name, street: auth.extra.raw_info.business_address.street, zip_code: auth.extra.raw_info.business_address.zip_code, city: auth.extra.raw_info.business_address.city, education: 'other', telephone: auth.extra.raw_info.business_address.phone, email: auth.extra.raw_info.active_email, birthday: date.new(auth.extra.raw_info.birth_date.year, auth.extra.raw_info.birth_date.month, auth.extra.raw_info.birth_date.day), passport_photo_url: auth.extra.raw_info.photo_urls.large ) raise @applicant.to_json end and the stuff displayed when exception raised:
{"id":null,"is_male":true,"first_name":"john","last_name":"doe","street":"foo bar street 123","zip_code":"12345","city":"johnscity","telephone":"12345678","email":"foo@bar.de","birthday":"2012-12-13","job_id":9,"created_at":null,"updated_at":null,"education":"other", "passport_photo_url":{"url":null}} it seems need like
passport_photo_url: { url: 'http://www.example.com/image.png' } but fails silently well.
any suggestions
thanks in advance!
ruby-on-rails ruby ruby-on-rails-4 carrierwave
No comments:
Post a Comment