Ruby on Rails Sunday, September 30, 2018


(a) Perhaps no one knows the answer.
(b) It's a weekend.


(c) You ask so many questions that are often not easy to understand that many do not bother trying any more.


How do i render an xml view like index.xml.erb or index.xml.builder 

d) Your question is badly written to the point of meaninglessness
e) You give the impression that you have made no attempt yourself to answer your question, and are just using this list to do your work for you
f) You give the impression that you are think you are entitled to answers (work) from other people on the list

if you want to improve on these things, there are many articles that can help.
e.g. https://medium.com/@gordon_zhu/how-to-be-great-at-asking-questions-e37be04d0603

--
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/e328ab8b-2084-4f05-bac0-220f7d7fcccb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Possibly related: Rails 5 has new (improved) behaviour for collection caching

<%= render partial: :post, collection: @posts, cached: true %>

will cache
although

<%= collection: @posts, cached: true %>

will not cache

more info on how it works and the benefits here:
https://blog.appsignal.com/2018/08/14/rails-collection-caching.html


On Monday, 24 September 2018 16:25:13 UTC+1, Steve wrote:
I've been developing with Rails for a few years now, but one part I haven't used is view fragment caching.

I'm using it now, and I'm seeing what I think is undesirable behavior, but I need someone with experience to tell me if it's supposed to be this way.

I'm caching a collection, and it runs the query to generate the cache key (count, max updated_at) as expected, but then regardless of whether there is a cache hit, it still runs the main query, and if there are includes, it runs those queries, too.  If the view fragment is being served from the cache, then those queries are just wasted time.  Has it always been like this?

I can work around it by using "<% cache @collection.cache_key do %>" instead of "<% cache @collection do %>", but it seems like it shouldn't run the query in the first place.

--
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/dcf902c2-9fd2-4841-a9db-51e9f6c01223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Sunday, September 30, 2018 at 1:31:35 AM UTC-4, Colin Law wrote:


On Sun, 30 Sep 2018, 06:19 Ralph Shnelvar, <ral...@dos32.com> wrote:
fugee,

(a) Perhaps no one knows the answer.
(b) It's a weekend.


(c) You ask so many questions that are often not easy to understand that many do not bother trying any more.

Colin


Ralph



Saturday, September 29, 2018, 10:10:53 PM, you wrote:


Why doesn't anyone answer my question am i blacklisted?
--
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/92674ae3-2eb3-40ec-ac37-0246699a292e%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.




Ralph

--
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/803563546.20180929221928%40dos32.com.
For more options, visit https://groups.google.com/d/optout.

Yea Thanks 

--
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/dc57aaa5-90a8-4e63-89b2-6601b6bec6af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Saturday, September 29, 2018



On Sun, 30 Sep 2018, 06:19 Ralph Shnelvar, <ralphs@dos32.com> wrote:
fugee,

(a) Perhaps no one knows the answer.
(b) It's a weekend.


(c) You ask so many questions that are often not easy to understand that many do not bother trying any more.

Colin


Ralph



Saturday, September 29, 2018, 10:10:53 PM, you wrote:


Why doesn't anyone answer my question am i blacklisted?
--
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/92674ae3-2eb3-40ec-ac37-0246699a292e%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.




Ralph

--
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/803563546.20180929221928%40dos32.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/CAL%3D0gLtYRaBgN2W-rUdWnw21oLExuC7_V%3DZJbxT63b23cPUJnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

fugee,

(a) Perhaps no one knows the answer.
(b) It's a weekend.

Ralph



Saturday, September 29, 2018, 10:10:53 PM, you wrote:


Why doesn't anyone answer my question am i blacklisted?
--
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/92674ae3-2eb3-40ec-ac37-0246699a292e%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.




Ralph

Ruby on Rails

How do i render an xml view like index.xml.erb or index.xml.builder

--
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/de84600a-6e50-4625-a681-2fb161d47272%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Why doesn't anyone answer my question am i blacklisted?

--
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/92674ae3-2eb3-40ec-ac37-0246699a292e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Sunday, September 23, 2018 at 10:44:50 AM UTC-4, Nielson Rolim wrote:

I'd suggest you create your own solution without ancestry.

I had a similar problem. I have an User model and each user must has one or more parents and one or more children. So I created a join table called users_parents with two attributes user_id and parent_id. In my User model I added to has_and_belongs_to_many entries:

has_and_belongs_to_many :parents, class_name: User, join_table: :users_parents, foreign_key: :user_id, association_foreign_key: :parent_id

has_and_belongs_to_many :children, class_name: User, join_table: :users_parents, foreign_key: :parent_id, association_foreign_key: :user_id

That way, I can add an user as parent of several users or an user as child of several users.

my_user.parents will return all my_user parents and my_user.children will return all my_user children

--  Nielson Rolim  nielso...@gmail.com
On 23/09/2018 08:06, fugee ohu wrote:
I wanna create and edit people but ancestry only provides for one parent_id so how can i have two on a form
--
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/b628326b-66ee-4f50-afb6-a238d2a0766f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks What's the difference between that and has_many through approach?

--
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/7d11a65d-07f8-49c4-880f-7dffa0326ad9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I wrote a sitemap controller and view but my index.xml.builder file is actually an html response not xml because that what google's site says I did a lot of searching but all the examples I find are how to render a resource as xml from a controller action but I'm trying to use an action/view pair "index" 

sitemap_controller.rb:
xml.instruct!
xml.urlset(:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9",
           "xmlns:xsi"=> "http://www.w3.org/2001/XMLSchema-instance",
            "xsi:schemaLocation"=>"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd") do
  # whatever logic your app has, e.g. static pages:
  @people.each do |person|
    xml.url do
      xml.loc person_url(person)
      xml.lastmod page.updated_at.to_date.to_s(:db)
      xml.changefreq "monthly"
      xml.priority 0.3
    end
  end
end

index.xml.builder:
xml.instruct!
xml.urlset(:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9",
           "xmlns:xsi"=> "http://www.w3.org/2001/XMLSchema-instance",
            "xsi:schemaLocation"=>"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd") do
  # whatever logic your app has, e.g. static pages:
  @people.each do |person|
    xml.url do
      xml.loc person_url(person)
      xml.lastmod page.updated_at.to_date.to_s(:db)
      xml.changefreq "monthly"
      xml.priority 0.3
    end
  end
end

--
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/c95441ee-86b6-4874-a786-bb1bd4bdf5af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Friday, September 28, 2018


Yeah, I created a Rails 3 and Rails 4 project.  Rails 3 doesn't support #cache_key on collection, and Rails 4 uses each individual element to create a cache key.

I set up byebug and traced the #cache view helper.  The reason the relation is being loaded is because the helper eventually calls #to_a on the relation, which of course results in the query being executed.

Looks like the best solution is using #cache_key directly.

--
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/5421611e-cbc9-4bda-9b92-fc5ae8238bdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Thursday, September 27, 2018

Hi all, 

Two different roles 
One is mid level - Up to $90k
One is Senior- Up to $140k

NO h1 or Third Parties- No sponsorship available for this role

No Relo at this time


Direct hire full time with full benefits/401k 


The client stack is Ruby on Rails, Postgres, Angular & Heroku; prior experience with Rails in a production environment is required for this role.


Again NO h1 or Third Parties- No sponsorship available for this role


If interested email me resume and a time to chat.


Have a great day!

Sincerely,

Jennifer Simpson-Black

Executive Director

S&B Consulting Group, LLC

Direct: 972 536 3585

jennifer@sbconsultinggroup.net

http://www.sbconsultinggroup.net

--
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/ba59dce2-0cf9-445b-8100-d81bc4ec1409%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi,

  I am new to rails and not sure if this is the correct place for newbie questions. I'm trying to deploy a small app in rails 5.2.1 to prod. In dev mode (-e development) it works but in prod mode (-e production) it throws error (see bottom). The only change I made after running rails new app is add a  local "gems" folder and add below code to Gemfile:

path './gems' do
  gem 'utils'
  gem 'dsl'
end

The rails version is 5.2.1 and ruby 2.3.0 on win7 64bit. Could anyone help or redirect me to the correct forum? Thank you in advance.

Regards,
He Qi

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cac
he/core_ext/active_support.rb:74:in `block in load_missing_constant': uninitiali
zed constant ActiveStorage::SetBlob (NameError)
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:74:in `rescue in load_missing_constan
t'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:57:in `load_missing_constant'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activestorage-5.2.1/app/cont
rollers/active_storage/blobs_controller.rb:8:in `<class:BlobsController>'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activestorage-5.2.1/app/cont
rollers/active_storage/blobs_controller.rb:7:in `<top (required)>'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/kernel_require.rb:21:in `require'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap
_lfi'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/loaded_features_index.rb:65:in `register'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/kernel_require.rb:29:in `require'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.2.1/lib/acti
ve_support/dependencies/interlock.rb:14:in `block in loading'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.2.1/lib/acti
ve_support/concurrency/share_lock.rb:151:in `exclusive'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.2.1/lib/acti
ve_support/dependencies/interlock.rb:13:in `loading'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.2/lib/bootsnap/
load_path_cache/core_ext/active_support.rb:80:in `depend_on'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:478:in `block (2 levels) in eager_load!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:477:in `each'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:477:in `block in eager_load!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:475:in `each'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:475:in `eager_load!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/eng
ine.rb:356:in `eager_load!'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/app
lication/finisher.rb:69:in `each'
        from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/app
lication/finisher.rb:69:in `block in <module:Finisher>'

--
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/7b624a1a-be08-4610-926c-de2ad1a75bb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Wednesday, September 26, 2018

I'm currently using WSL on Windows 10 for developing in Rails.  So far I've never had any issues, but noticed I'm unable to run "system" tests.  

For testing I've done the following:

  • "rails new sample" (created a new rails 5.2 app called sample)
  • "rails generate scaffold user first_name:string last_name:string" (created resource for running system tests)
  • rails test test/system/users_test.rb (this command produced the following)

daveomcd@LAPTOP-GDA9LTDQ:~/rails_projects/sample$ rails test test/system/users_test.rb
Running via Spring preloader in process 2613
/home/daveomcd/.rvm/gems/ruby-2.4.2/gems/spring-2.0.2/lib/spring/application.rb:185: warning: Insecure world writable dir /home/daveomcd/.rvm/gems/ruby-2.4.2/bin in PATH, mode 040777
Run options: --seed 35177


# Running:


E


Error:
UsersTest#test_destroying_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
 
(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)
    test/system/users_test.rb:38:in `block in <class:UsersTest>'



Error:
UsersTest#test_destroying_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
 
(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)






bin/rails test test/system/users_test.rb:37


E


Error:
UsersTest#test_creating_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn'
t exist)
 
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
 
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)
    test
/system/users_test.rb:14:in `block in <class:UsersTest>'


Error:
UsersTest#test_creating_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)






bin/rails test test/system/users_test.rb:13


E


Error:
UsersTest#test_updating_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)
    test/system/users_test.rb:26:in `
block in <class:UsersTest>'


Error:
UsersTest#test_updating_a_User:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn'
t exist)
 
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
 
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)






bin
/rails test test/system/users_test.rb:25


E


Error:
UsersTest#test_visiting_the_index:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
 
(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)
    test/system/users_test.rb:9:in `block in <class:UsersTest>'



Error:
UsersTest#test_visiting_the_index:
Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally
 
(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-17134-Microsoft x86_64)






bin/rails test test/system/users_test.rb:8






Finished in 22.996091s, 0.1739 runs/s, 0.0000 assertions/s.
4 runs, 0 assertions, 0 failures, 4 errors, 0 skips

Can anyone tell me if this is a WSL issue? Or if I'm doing anything wrong?  I'm struggling on options to debug, troubleshoot this issue.  Thanks!

--
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/47cfba36-d745-42c6-b586-61f6ccea9593%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Tuesday, September 25, 2018

The initial release of Active Storage (as part of Rails 5.2) did not include the ability to validate attachments

Validations are intended to be a part of the Rails 6 release. Work to support this has already begun

In the meantime, if you need validations for Active Storage attachments right now, you can roll your own using custom validators. I have written a few blog posts on the subject that you might find helpful:
Hope that helps!

On Friday, September 1, 2017 at 5:09:37 PM UTC-4, Tobias Sandelius wrote:
I can't find any docs about attachment validations. Are there any? If not, will it be added?

--
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/5d3f3686-c515-40d9-acb1-c60fb8d9e62f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Monday, September 24, 2018

In Rails 5, you can turn cache versioning on and override #cache_version in your model if you'd like to return a different column.

https://github.com/rails/rails/blob/b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c/activerecord/lib/active_record/integration.rb

In earlier versions of Rails, you can pass different column names to #cache_key, e.g., model.cache_key(:last_modified).

In either case, you can probably just override #cache_key in the model.

On Saturday, September 1, 2018 at 12:38:53 PM UTC-5, SeongHoon Ryu wrote:

I want to cache with custom cache_key of Fragment Caching because I don't want to change updated_at.


So, I googled and found monkeypatch(https://gist.github.com/tispratik/9276110). But It just a monkey patch.


Is there a way to set custom cache_key?

Thanks


--
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/ad662458-cfc1-4363-9e03-0b27d81c4943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I've been developing with Rails for a few years now, but one part I haven't used is view fragment caching.

I'm using it now, and I'm seeing what I think is undesirable behavior, but I need someone with experience to tell me if it's supposed to be this way.

I'm caching a collection, and it runs the query to generate the cache key (count, max updated_at) as expected, but then regardless of whether there is a cache hit, it still runs the main query, and if there are includes, it runs those queries, too.  If the view fragment is being served from the cache, then those queries are just wasted time.  Has it always been like this?

I can work around it by using "<% cache @collection.cache_key do %>" instead of "<% cache @collection do %>", but it seems like it shouldn't run the query in the first place.

--
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/cf613f24-c38f-4961-a63a-e52aee5a39cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Sunday, September 23, 2018

On Sunday, September 23, 2018 at 5:20:41 PM UTC+1, strzibny@gmail.com wrote:
> Hello all,
>
> I cannot seem to find a way how to reference named fixtures in cases where Rails fixtures auto-id magic is not working.
>
> Imagine a model Message with attributes from and to as integers indicating users IDs.
>
> Now the following fixture won't work:
>
> hello_steve:
>   to: steve
>   from: jana
>   text: Hello there!
>

You need to use the association name, not the foreign key, ie (with the associations you have shown):

recipient: steve

Instead of

to: steve.

it also won't work if you have explicitly assigned an id to steve in the user's.yml File

Fred



> (Given steve and jana are defined in users.yml. They work for other fixtures defined with standard Rails conventions.)
>
> The thing is I need to reference them here (or their ID).
>
> Thing I tried was to put in place Rails belongs_to:
>
> # user.rb
> has_many :sent_messages, class_name: 'Message', foreign_key: 'from'
> has_many :received_messages, class_name: 'Message', foreign_key: 'to'
>
> # message.rb
> belongs_to :recipient, class_name: 'User', foreign_key: 'to'
> belongs_to :author, class_name: 'User', foreign_key: 'from'
>
> Unfortunately Rails won't pick it up and all messages fixtures end up with from and to as '0'.
> Note that the association works, just not for fixtures.
>
> Any ideas?
>
> Thank you
> Josef

--
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/adaf5c7c-14fe-4d32-9a23-1fcbf9591663%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hello all,

I cannot seem to find a way how to reference named fixtures in cases where Rails fixtures auto-id magic is not working.

Imagine a model Message with attributes from and to as integers indicating users IDs.

Now the following fixture won't work:

hello_steve:
  to: steve
  from: jana
  text: Hello there!

(Given steve and jana are defined in users.yml. They work for other fixtures defined with standard Rails conventions.)

The thing is I need to reference them here (or their ID).

Thing I tried was to put in place Rails belongs_to:

# user.rb
has_many :sent_messages, class_name: 'Message', foreign_key: 'from'
has_many :received_messages, class_name: 'Message', foreign_key: 'to'

# message.rb
belongs_to :recipient, class_name: 'User', foreign_key: 'to'
belongs_to :author, class_name: 'User', foreign_key: 'from'

Unfortunately Rails won't pick it up and all messages fixtures end up with from and to as '0'.
Note that the association works, just not for fixtures.

Any ideas?

Thank you
Josef

--
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/ebf60074-64dc-4e4b-b98e-3769c407d577%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'd suggest you create your own solution without ancestry.

I had a similar problem. I have an User model and each user must has one or more parents and one or more children. So I created a join table called users_parents with two attributes user_id and parent_id. In my User model I added to has_and_belongs_to_many entries:

has_and_belongs_to_many :parents, class_name: User, join_table: :users_parents, foreign_key: :user_id, association_foreign_key: :parent_id

has_and_belongs_to_many :children, class_name: User, join_table: :users_parents, foreign_key: :parent_id, association_foreign_key: :user_id

That way, I can add an user as parent of several users or an user as child of several users.

my_user.parents will return all my_user parents and my_user.children will return all my_user children

--  Nielson Rolim  nielson.rolim@gmail.com
On 23/09/2018 08:06, fugee ohu wrote:
I wanna create and edit people but ancestry only provides for one parent_id so how can i have two on a form
--
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/b628326b-66ee-4f50-afb6-a238d2a0766f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I wanna create and edit people but ancestry only provides for one parent_id so how can i have two on a form

--
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/b628326b-66ee-4f50-afb6-a238d2a0766f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Saturday, September 22, 2018

Thankyou 

On Fri, Sep 21, 2018 at 6:02 PM Walter Lee Davis <waltd@wdstudio.com> wrote:

> On Sep 21, 2018, at 8:03 AM, Daynthan Kabilan <dayanthan86@gmail.com> wrote:
>
> Hi,
>
> Anyone please give me some idea about how to write test case with API endpoints.
>
> I have used multiple API in my application. Currently i need to write the testcase to the API. So needs to be some request test specs (using rspec, preferrably) for all of the major ruby API endpoints.
>
> Thanks for advance

We use VCR to wrap around the API. https://github.com/vcr/vcr It's pretty straightforward. You put a VCR block around the part of your test that requests the external resource, and then you just make a normal request inside your test. The first time it runs, VCR will write out a "cassette" for that request, which is just a serialized version of the HTTP traffic response. The next time it runs, you will hit the cassette, not the network. Saves a bunch of time when you are done fiddling with the API tests and have moved on to other parts of your app. If you ever worry about your tests getting away from reality, you can just delete the cassettes and run the test again to refresh them with a newer version.

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/CADKeJyQfjN6WoE1GeBdVR%3DTqTGMS5uOxRYzKRF35eTzUAwdQfQ%40mail.gmail.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/10175416-F15A-4AFC-82E2-0E4E85A7605C%40wdstudio.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/CADKeJyQ%2BV7%2B0T%2BDAbveBj_tf2giTb7ueesyas_Ry5MHeUk8K5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Friday, September 21, 2018

enum status: [ :in_progress, :on_hold, :cancelled, :shipped ]

I need to split :shipped based on before or after one year from the current date.

enum status: [ :in_progress, :on_hold, :cancelled, :shipped, :archive_shipped ]

how to I write out the scope for the condition? Or should it be written as a self.phase method?

--
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/59f2c76a-1a21-44e4-8428-756754812a13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.