Hi All--I just wanted to share a job opportunity with the group... people can email me at lori@rouleausearch.com for all the details! ThanksRuby on Rails Developer in San Francisco
- Join 80 of the most talented and fun Ruby on Rails Full Stack Developers in San Fran.
- We're here to change primary health care at it's core!
- Come learn from us and share your tips, trick and favorite Ruby Gems!
- Apply your skills to a cause! Help revolutionize healthcare in the US
- Our mission's to elevate a doctor's office visit to 5 star spa experience…
- Very, very healthy work-life balance. Start around 9, everyone leaves by 5:30. They focus on mental health for their teams, people aren't working late nights
- Conferences, speaking engagements, brown bag lunches, and hackathons!
- Diversity 50% woman and LBGTQ-inclusive hiring
Pay range: $150K - $220K
Too many perks to list!
TECH STACK
Ruby on Rails (RoR), Rails, Angular, GraphQL, API, iOS, Swift, Objective-C, Kotlin, Android, AWS, MySQL, Redis, ElasticSearch, Hadoop
To schedule a confidential / exploratory 15 minute call, please send your availability and contact info.
Thanks Ruby Enthusiasts!
Lori Rouleau
Rouleau Search Partners
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/02f62722-42dc-430f-9671-fc37fc63e8e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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/CAEOjMEJbsD0O9ADZCuro07p%3DXv9hcFP3YMwYBi0dFyNYRNLnyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Ruby on Rails Developer in San Francisco
- Join 80 of the most talented and fun Ruby on Rails Full Stack Developers in San Fran.
- We're here to change primary health care at it's core!
- Come learn from us and share your tips, trick and favorite Ruby Gems!
- Apply your skills to a cause! Help revolutionize healthcare in the US
- Our mission's to elevate a doctor's office visit to 5 star spa experience…
- Very, very healthy work-life balance. Start around 9, everyone leaves by 5:30. They focus on mental health for their teams, people aren't working late nights
- Conferences, speaking engagements, brown bag lunches, and hackathons!
- Diversity 50% woman and LBGTQ-inclusive hiring
Pay range: $150K - $220K
Too many perks to list!
TECH STACK
Ruby on Rails (RoR), Rails, Angular, GraphQL, API, iOS, Swift, Objective-C, Kotlin, Android, AWS, MySQL, Redis, ElasticSearch, Hadoop
To schedule a confidential / exploratory 15 minute call, please send your availability and contact info.
Thanks Ruby Enthusiasts!
Lori Rouleau
Rouleau Search Partners
lori@rouleausearch.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/02f62722-42dc-430f-9671-fc37fc63e8e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Wednesday, 31 October 2018 11:13:27 UTC+1, belgoros wrote:
I tried to use dire upload way from Ember app to Rails API and used ember-active-storage add-on. Rails responds with the following error when I tried to attach a file:Cannot POST /rails/active_storage/direct_uploads 404 - Resource was not found.All Rails controller are protected with before_action filter defined in ApplicationController:
class ApplicationController < ActionController::API
before_action :authorize_request
attr_reader :current_user
private
def authorize_request
@current_user = (AuthorizeApiRequest.new(request .headers).call)[:user]
end
endI inspected the headers used when posting the request, - it seems to be OK and contains Authorization:Authorization:Bearer eyJhbG.....
and the request payload:
- blob: {filename: "Screenshot 2018-10-31 at 10.45.21.png", content_type: "image/png", byte_size: 110466,…}
- byte_size: 110466
- checksum: "L+1wS2rPR7cKkXP/Rb/
rig==" - content_type: "image/png"
- filename: "Screenshot 2018-10-31 at 10.45.21.png"
What's wrong with that ? Thank you.
- I created DirectUploadsController by extending it from ActiveStorage::DirectUploadsController as follows:
class DirectUploadsController < ActiveStorage::DirectUploadsController
protect_from_forgery with: :exception
skip_before_action :verify_authenticity_token
end
Rails.application.routes.draw do
resources :posts
post '/rails/active_storage/direct_uploads' => 'direct_uploads#create'
end
class PostSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :id, :title, :body, :tag_ids, :archived, :photo
def photo
url_for(object.photo) if object.photo.attached?
end
end
class Post < ApplicationRecord
serialize :tag_ids, Array
validates :title, :body, :tag_ids, presence: true
has_one_attached :photo
end
def create
@post = Post.new(post_params)
if @post.save
render json: @post, status: :created, location: @post
else
respond_with_errors @post
end
end
def post_params
ActiveModelSerializers::Deserialization.jsonapi_parse!(params,
only: [:title, :body, :tag_ids, :archived, :photo])
end
But when posting a new Post data, there are still errors:
Started POST "/posts" for 127.0.0.1 at 2018-10-31 16:26:48 +0100
Processing by PostsController#create as JSONAPI
Parameters: {"data"=>{"attributes"=>{"title"=>"post-1", "body"=>"azertyui", "archived"=>true, "tag_ids"=>[12], "photo"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6209e9184fe8b05b5ce883ac1d38cfde6925c16b"}, "type"=>"posts"}}
ActiveStorage::Blob Load (0.2ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = ? LIMIT ? [["id", 9], ["LIMIT", 1]]
↳ app/controllers/posts_controller.rb:18
(0.0ms) begin transaction
↳ app/controllers/posts_controller.rb:18
(0.0ms) commit transaction
↳ app/controllers/posts_controller.rb:18
(0.0ms) begin transaction
↳ app/controllers/posts_controller.rb:20
Post Create (0.3ms) INSERT INTO "posts" ("title", "body", "tag_ids", "archived", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["title", "post-1"], ["body", "azertyui"], ["tag_ids", "---\n- 12\n"], ["archived", 1], ["created_at", "2018-10-31 15:26:49.023471"], ["updated_at", "2018-10-31 15:26:49.023471"]]
↳ app/controllers/posts_controller.rb:20
ActiveStorage::Attachment Create (0.3ms) INSERT INTO "active_storage_attachments" ("name", "record_type", "record_id", "blob_id", "created_at") VALUES (?, ?, ?, ?, ?) [["name", "photo"], ["record_type", "Post"], ["record_id", 28], ["blob_id", 9], ["created_at", "2018-10-31 15:26:49.025251"]]
↳ app/controllers/posts_controller.rb:20
Post Update (0.1ms) UPDATE "posts" SET "updated_at" = ? WHERE "posts"."id" = ? [["updated_at", "2018-10-31 15:26:49.026607"], ["id", 28]]
↳ app/controllers/posts_controller.rb:20
(1.4ms) commit transaction
↳ app/controllers/posts_controller.rb:20
(0.0ms) begin transaction
↳ app/controllers/posts_controller.rb:20
ActiveStorage::Blob Update (0.3ms) UPDATE "active_storage_blobs" SET "metadata" = ? WHERE "active_storage_blobs"."id" = ? [["metadata", "{\"identified\":true}"], ["id", 9]]
↳ app/controllers/posts_controller.rb:20
(0.6ms) commit transaction
↳ app/controllers/posts_controller.rb:20
[ActiveJob] Enqueued ActiveStorage::AnalyzeJob (Job ID: 09817808-2dcd-499e-ade3-cc9e7fa0156a) to Async(default) with arguments: #<GlobalID:0x00007f8b3aee0ee0 @uri=#<URI::GID gid://draft-api/ActiveStorage::Blob/9>>
ActiveStorage::Blob Load (0.1ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = ? LIMIT ? [["id", 9], ["LIMIT", 1]]
↳ /Users/Serguei/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.0/lib/active_record/log_subscriber.rb:98
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] Performing ActiveStorage::AnalyzeJob (Job ID: 09817808-2dcd-499e-ade3-cc9e7fa0156a) from Async(default) with arguments: #<GlobalID:0x00007f8b38350370 @uri=#<URI::GID gid://draft-api/ActiveStorage::Blob/9>>
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] Skipping image analysis because the mini_magick gem isn't installed
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] (0.0ms) begin transaction
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] ↳ /Users/Serguei/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.0/lib/active_record/log_subscriber.rb:98
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] ActiveStorage::Blob Update (0.2ms) UPDATE "active_storage_blobs" SET "metadata" = ? WHERE "active_storage_blobs"."id" = ? [["metadata", "{\"identified\":true,\"analyzed\":true}"], ["id", 9]]
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] ↳ /Users/Serguei/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.0/lib/active_record/log_subscriber.rb:98
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] (0.6ms) commit transaction
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] ↳ /Users/Serguei/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.0/lib/active_record/log_subscriber.rb:98
[ActiveJob] [ActiveStorage::AnalyzeJob] [09817808-2dcd-499e-ade3-cc9e7fa0156a] Performed ActiveStorage::AnalyzeJob (Job ID: 09817808-2dcd-499e-ade3-cc9e7fa0156a) from Async(default) in 5.75ms
[active_model_serializers] Rendered PostSerializer with ActiveModelSerializers::Adapter::JsonApi (1.67ms)
Completed 500 Internal Server Error in 71ms (ActiveRecord: 4.1ms)
ArgumentError (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
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/6eb48ee3-1ba9-4ac3-b4d3-9620a7777382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
class ApplicationController < ActionController::API
before_action :authorize_request
attr_reader :current_user
private
def authorize_request
@current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]
end
end
and the request payload:
- blob: {filename: "Screenshot 2018-10-31 at 10.45.21.png", content_type: "image/png", byte_size: 110466,…}
- byte_size: 110466
- checksum: "L+1wS2rPR7cKkXP/Rb/rig=="
- content_type: "image/png"
- filename: "Screenshot 2018-10-31 at 10.45.21.png"
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/f6068bec-9fe4-4019-9691-c535ac051b9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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/CAA6WWt8Pu9znj_Z1PXv-QcgXkKwFQacFFecAVDBKHztqpa6EnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
stream_from 'some_channel', coder: ActiveSupport::JSON do |person|
transmit(thing) if (person['age'].to_i > params[:min_age])
end
On Wednesday, October 31, 2018 at 2:30:44 AM UTC+9, Stefan Buhrmester wrote:
Hello all,I've been searching a lot but wasn't able to find a solution for this (what I thought should be a really "simple" thing).Basically, what I want to do is to create a subscription where the messages that are received by the subscriber are filtered based on the passed params.For example, something like this:
class
PeopleChannel < ApplicationCable::Channel
# only send people that are older than params[:min_age]
def
subscribed
stream_for Person do |person|
person.age > params[:min_age]end
end
end
Or, what would be a kick-ass feature but probably difficult to implement, would be to stream from an active record relation, and send only the records that are included in the relation (even if they have just been created).
class
PeopleChannel < ApplicationCable::Channel
# only send things that are older than some age
def
subscribed
people = Person.where('age > ?', params[:min_age])stream_for people
end
end
Anybody got any ideas how to do this? Filtering messages seems like such a basic thing but I can't find a way.Stefan
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/055271fc-5d6e-47b4-ab60-8a6886868960%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Tuesday, October 30, 2018 at 1:24:55 PM UTC-4, Walter Lee Davis wrote:
> On Oct 30, 2018, at 1:11 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Tuesday, October 30, 2018 at 1:02:59 PM UTC-4, Walter Lee Davis wrote:
>
> > On Oct 30, 2018, at 12:09 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> > On Monday, October 29, 2018 at 11:28:58 PM UTC-4, Walter Lee Davis wrote:
> >
> > > On Oct 29, 2018, at 10:08 PM, fugee ohu <fuge...@gmail.com> wrote:
> > >
> > >
> > >
> > > On Monday, October 29, 2018 at 10:14:44 AM UTC-4, Colin Law wrote:
> > > On Mon, 29 Oct 2018 at 11:54, fugee ohu <fuge...@gmail.com> wrote:
> > >
> > >
> > > On Monday, October 29, 2018 at 4:48:42 AM UTC-4, Colin Law wrote:
> > > On Mon, 29 Oct 2018 at 05:08, fugee ohu <fuge...@gmail.com> wrote:
> > > How do I create an image object from a remote image url in rails console
> > >
> > > What do you mean by image object?
> > >
> > >
> > > An object returned by Nokogiri as a result of selecting a css.("a") element containing <img src="...">
> > >
> > > That doesn't make sense, you ask how to create an image object, then say that an image object is an object returned by nokogiri. So to create it all you have to do is make that request to nokogiri.
> > >
> > > Colin
> > >
> > >
> > > I'm trying to insert an image into the assets table from web scraping Scraping gets me the src of the image I don't know if I should submit a form or do a raw insert in my script
> >
> > Read the documentation for your file upload package -- I believe you mentioned ActiveStorage -- about uploading from a URL. This is a common feature in many file attachment systems. CarrierWave, Shrine, CarrierWave, even Paperclip have a way to do this.
> >
> > It usually amounts to something like
> >
> > require 'open-uri'
> > file = open(remote_url).read
> > @your_instance.file = file
> > @your_instance.save # (the file should be persisted locally)
> >
> > Walter
> >
> > >
> > > --
> > > 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-ta...@googlegroups.com .
> > > To post to this group, send email to rubyonra...@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .9f8ba9af-0ad0-4fd0-856b- 0f236c76149b%40googlegroups. com
> > > For more options, visit https://groups.google.com/d/optout .
> >
> >
> > Thanks, I'll use Carrierwave because when I googled "ActiveStorage remote file upload" what I found was a discussion where someone says you can't do this in ActiveStorage but you can with Carrierwave
> >
> >
>
> I'd recommend Shrine. Much better documentation, current development, and a super-responsive development team.
>
> Walter
>
> > --
> > 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-ta...@googlegroups.com .
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .2eebec62-614c-4d0e-9834- 7c3a80bb4112%40googlegroups. com
> > For more options, visit https://groups.google.com/d/optout .
>
>
> With 'require open-uri' i can just use ActiveStorage don't need to use a gem?
>
Open-URI is part of the Ruby standard library, not a third-party Gem. If you are in a Rails app, you won't need to do this, because it's part of the requirements. But if you are building a stand-alone script for testing, as you should, you may need to do this before the Kernel.open command will open a URI.
Walter
> --
> 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-ta...@googlegroups.com .
> To post to this group, send email to rubyonra...@googlegroups.com .
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .30ffe7c3-39b5-43eb-a232- 94fb8e5696de%40googlegroups. com
> For more options, visit https://groups.google.com/d/optout .
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/955c9d6e-2406-4c9e-aa32-e25fbf4d89d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> On Oct 30, 2018, at 1:11 PM, fugee ohu <fugee279@gmail.com> wrote:
>
>
>
> On Tuesday, October 30, 2018 at 1:02:59 PM UTC-4, Walter Lee Davis wrote:
>
> > On Oct 30, 2018, at 12:09 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> > On Monday, October 29, 2018 at 11:28:58 PM UTC-4, Walter Lee Davis wrote:
> >
> > > On Oct 29, 2018, at 10:08 PM, fugee ohu <fuge...@gmail.com> wrote:
> > >
> > >
> > >
> > > On Monday, October 29, 2018 at 10:14:44 AM UTC-4, Colin Law wrote:
> > > On Mon, 29 Oct 2018 at 11:54, fugee ohu <fuge...@gmail.com> wrote:
> > >
> > >
> > > On Monday, October 29, 2018 at 4:48:42 AM UTC-4, Colin Law wrote:
> > > On Mon, 29 Oct 2018 at 05:08, fugee ohu <fuge...@gmail.com> wrote:
> > > How do I create an image object from a remote image url in rails console
> > >
> > > What do you mean by image object?
> > >
> > >
> > > An object returned by Nokogiri as a result of selecting a css.("a") element containing <img src="...">
> > >
> > > That doesn't make sense, you ask how to create an image object, then say that an image object is an object returned by nokogiri. So to create it all you have to do is make that request to nokogiri.
> > >
> > > Colin
> > >
> > >
> > > I'm trying to insert an image into the assets table from web scraping Scraping gets me the src of the image I don't know if I should submit a form or do a raw insert in my script
> >
> > Read the documentation for your file upload package -- I believe you mentioned ActiveStorage -- about uploading from a URL. This is a common feature in many file attachment systems. CarrierWave, Shrine, CarrierWave, even Paperclip have a way to do this.
> >
> > It usually amounts to something like
> >
> > require 'open-uri'
> > file = open(remote_url).read
> > @your_instance.file = file
> > @your_instance.save # (the file should be persisted locally)
> >
> > Walter
> >
> > >
> > > --
> > > 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-ta...@googlegroups.com.
> > > To post to this group, send email to rubyonra...@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9f8ba9af-0ad0-4fd0-856b-0f236c76149b%40googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > Thanks, I'll use Carrierwave because when I googled "ActiveStorage remote file upload" what I found was a discussion where someone says you can't do this in ActiveStorage but you can with Carrierwave
> >
> >
>
> I'd recommend Shrine. Much better documentation, current development, and a super-responsive development team.
>
> Walter
>
> > --
> > 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-ta...@googlegroups.com.
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2eebec62-614c-4d0e-9834-7c3a80bb4112%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> With 'require open-uri' i can just use ActiveStorage don't need to use a gem?
>
Open-URI is part of the Ruby standard library, not a third-party Gem. If you are in a Rails app, you won't need to do this, because it's part of the requirements. But if you are building a stand-alone script for testing, as you should, you may need to do this before the Kernel.open command will open a URI.
Walter
> --
> 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/30ffe7c3-39b5-43eb-a232-94fb8e5696de%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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/4A35BBD1-EFD5-44F8-A418-C79D14B56283%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
On Tuesday, October 30, 2018 at 1:02:59 PM UTC-4, Walter Lee Davis wrote:
> On Oct 30, 2018, at 12:09 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Monday, October 29, 2018 at 11:28:58 PM UTC-4, Walter Lee Davis wrote:
>
> > On Oct 29, 2018, at 10:08 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> > On Monday, October 29, 2018 at 10:14:44 AM UTC-4, Colin Law wrote:
> > On Mon, 29 Oct 2018 at 11:54, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> > On Monday, October 29, 2018 at 4:48:42 AM UTC-4, Colin Law wrote:
> > On Mon, 29 Oct 2018 at 05:08, fugee ohu <fuge...@gmail.com> wrote:
> > How do I create an image object from a remote image url in rails console
> >
> > What do you mean by image object?
> >
> >
> > An object returned by Nokogiri as a result of selecting a css.("a") element containing <img src="...">
> >
> > That doesn't make sense, you ask how to create an image object, then say that an image object is an object returned by nokogiri. So to create it all you have to do is make that request to nokogiri.
> >
> > Colin
> >
> >
> > I'm trying to insert an image into the assets table from web scraping Scraping gets me the src of the image I don't know if I should submit a form or do a raw insert in my script
>
> Read the documentation for your file upload package -- I believe you mentioned ActiveStorage -- about uploading from a URL. This is a common feature in many file attachment systems. CarrierWave, Shrine, CarrierWave, even Paperclip have a way to do this.
>
> It usually amounts to something like
>
> require 'open-uri'
> file = open(remote_url).read
> @your_instance.file = file
> @your_instance.save # (the file should be persisted locally)
>
> Walter
>
> >
> > --
> > 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-ta...@googlegroups.com .
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .9f8ba9af-0ad0-4fd0-856b- 0f236c76149b%40googlegroups. com
> > For more options, visit https://groups.google.com/d/optout .
>
>
> Thanks, I'll use Carrierwave because when I googled "ActiveStorage remote file upload" what I found was a discussion where someone says you can't do this in ActiveStorage but you can with Carrierwave
>
>
I'd recommend Shrine. Much better documentation, current development, and a super-responsive development team.
Walter
> --
> 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-ta...@googlegroups.com .
> To post to this group, send email to rubyonra...@googlegroups.com .
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .2eebec62-614c-4d0e-9834- 7c3a80bb4112%40googlegroups. com
> For more options, visit https://groups.google.com/d/optout .
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/30ffe7c3-39b5-43eb-a232-94fb8e5696de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.