[Rails] Class variables and Rails ... how global? When initialized? Thread safety?

2017-07-14 Thread Ralph Shnelvar
I'm trying to understand something basic about Rails (and Apache). This is a follow-up to Matt Jones' answer in https://groups.google.com/forum/#!topic/rubyonrails-talk/y6ktv7rL6IA I repeat his answer here > I suspect `User.exists?` is going to be the lightest possible option. > `User.count ==

[Rails] Rspec. assert_select deprecated?

2017-07-14 Thread Ralph Shnelvar
In https://apidock.com/rails/ActionController/Assertions/SelectorAssertions/assert_select I see that assert_select was deprecated. Yes, when I run rails generate scaffold SqlStatement \ title:text{120} \ description:text \ sql_stmt:text I find the following code generated in ~/spec/vie

[Rails] Re: RBAC_CANCAN

2017-07-14 Thread David Gleba
I use devise and cancancan for login and roles. In my little rails app generator project: https://github.com/dgleba/bashrail there are scripts for this. Even if you don't use the scripts, they document exactly how to implement it in that case. look at: https://github.com/dgleba/bashrail/blo

[Rails] Re: Class variables and Rails ... how global? When initialized? Thread safety?

2017-07-14 Thread Frederick Cheung
On Friday, July 14, 2017 at 9:40:56 AM UTC+1, Ralph Shnelvar wrote: > > > > > In > class User < ActiveRecord::Base > def self.any_users? >@any_users ||= exists? > end > end > > So at some point in the code, I call > User.any_users; > So Ruby says "Ok, @any_users isn't defined so I'm going to

[Rails] Re: Rspec. assert_select deprecated?

2017-07-14 Thread Frederick Cheung
On Friday, July 14, 2017 at 9:58:56 AM UTC+1, Ralph Shnelvar wrote: > > So is it deprecated? What's it replaced by? Where can I find > documentation? > > apidock things things are deprecated when they move - it doesn't know it was extracted into the rails-dom-testing gem > I find no menti

[Rails] Re: Rspec. assert_select deprecated?

2017-07-14 Thread Ralph Shnelvar
So ... where can I find current documentation on assert_select? Is assert_select an Rspec facility or a wrapper around some other facility I need to learn? If it isn't apparent, Fred, thank you. Ralph On Friday, July 14, 2017 at 5:15:04 AM UTC-6, Frederick Cheung wrote: > > > On Friday, July

[Rails] Encrypted secrets for different environments

2017-07-14 Thread Grzegorz
Hey guys, The new feature of encrypted secrets is super cool cause I can have all tokens and access keys configured once and secure, however it's getting more complicated when it comes to different environments. It often happens that many developers work on a project but only a few of them shoul

[Rails] Re: Rspec. assert_select deprecated?

2017-07-14 Thread Frederick Cheung
On Friday, July 14, 2017 at 2:49:48 PM UTC+1, Ralph Shnelvar wrote: > So ... where can I find current documentation on assert_select? > > Is assert_select an Rspec facility or a wrapper around some other facility I > need to learn? > It was extracted from rails into the rails-dom-testing gem, s

[Rails] Rspec. Is 302 a success? Why 302?

2017-07-14 Thread Ralph Shnelvar
I have the following code, which was automagically created, in ~/controllers/articles_controller_spec.rb describe "GET #new" do it "returns a success response" do # See Hassan's answer in # https://groups.google.com/forum/#!topic/rubyonrails-talk/OQIYz9mnBXU byebug

Re: [Rails] Ruby on Rails Talk: Moderated?

2017-07-14 Thread Karthikeyan A K
I would be very careful about Ruby groups because of my personal experience. I am in Chennai, India and I was thrown out of ChennaiRb and BangloreRb because a discussion that erupted about my book "I Love Ruby" and there was prejudice. Lets say one claims to be democratic, then it means one has v

[Rails] How to find where be_success is defined

2017-07-14 Thread Ralph Shnelvar
So this is both a specific and a general question Specific question: I am trying to find where be_success is defined. In Ubuntu, I used DoubleCmd (a clone of Window's wonderful Total Commander) to scan for be_success without, uh, success. That's the specific question. I can see the following