[Rails] Re: What generates articles_index_path ?

2017-07-10 Thread Ralph Shnelvar
I'm going to try to answer my own question. I tracked down this answer: https://stackoverflow.com/questions/23819312/rails-undefined-method-user-index-pathEnter code here. The most important sentence tompave wrote in

[Rails] Re: Custom UUID generator

2017-07-10 Thread gorav
You can also do following with pg: class FirstSetOfTables < ActiveRecord::Migration[5.1] enable_extension 'pgcrypto' unless extensions.include?('pgcrypto') create_table :tokens, id: :uuid do |t| t.integer:action, null: false, default: 1 t.integer:status,

Re: [Rails] one database multiple sites

2017-07-10 Thread gorav
The way I architect such Apps is by using centralized scope based authorization. It keeps the App clean and avoid bugs like dev forgot to scope the records in controller - controller can ONLY operate on records that are permitted for the current user. If somebody tries to access resource

Re: [Rails] Custom UUID generator

2017-07-10 Thread Matt Hickman
That statement you pasted defines it, it's stored as a function in postgres. See https://www.postgresql.org/docs/9.5/static/xfunc-sql.html for docs on how this works in postgres. John Pearson July 10, 2017 at 2:36 PMvia Postbox

Re: [Rails] Custom UUID generator

2017-07-10 Thread John Pearson
My question, if this is my migration: *migration.rb* def change connection.execute <<-SQLCREATE OR REPLACE FUNCTION john_uuid_generator() RETURNS uuidAS $$ SELECT * FROM #{uuid_function} $$LANGUAGE SQL VOLATILE;SQL end Where do I define john_uuid_generator()? Thanks! On Mon, Jul 10, 2017

Re: [Rails] Custom UUID generator

2017-07-10 Thread Matt Hickman
uuid_function is defined - https://github.com/rails/rails/blob/650ea5e5cf50d8a7242499463cf1762922d330a8/activerecord/test/cases/adapters/postgresql/uuid_test.rb#L14 - it just switches on if postgres supports gen_random_uuid() otherwise it uses uuid_generate_v4() gen_random_uuid() is part of

Re: [Rails] Rspec =begin =end

2017-07-10 Thread Mugurel Chirica
That is a multi line ruby comment, but it's not that popular, you are better off using multiple single line comments #comment. The reason is there is so you can remove them and that block will have the comments and the config.filter_run :focus (...) lines working properly. -- You received this

[Rails] Rspec =begin =end

2017-07-10 Thread Ralph Shnelvar
Title: Rspec =begin =end I don't know if this is a Rails, Ruby, or Rspec question. In a file named spec/spec_helper.rb I have RSpec.configure do |config| # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content.

Re: [Rails] Custom UUID generator

2017-07-10 Thread johnpearson555
That's what I thought but I wasn't sure where to place the uuid_function that the migration refers to. So that go in a helper file or part of the

[Rails] What generates articles_index_path ?

2017-07-10 Thread Ralph Shnelvar
Title: What generates articles_index_path ? I am porting some Rails 4 code to Rails 5 and I hit the following problem when using  Rspec:  articles_index_path  is undefined. routes.rb Rails.application.routes.draw do  devise_for :users  root 'static_pages#root'  resources :users  resources

[Rails] Rails 4.2 can't precompile assets in vendor/assets folder

2017-07-10 Thread João Bordalo
Hi there, I noticed that, in production, when I $ rake assets:precompile, the assets I have in vendor/assets aren't precompiled. Doing some research I found that in Rails 4.2 they no longer precompile those assets by default. Is there any other way to do this? I'm using sprockets-rails

[Rails] Re: Rspec failure with :get. :get documentation?

2017-07-10 Thread Frederick Cheung
On Sunday, July 9, 2017 at 9:55:30 AM UTC+1, Ralph Shnelvar wrote: > > > Questions: > > 1) Does the message "wrong number of arguments (given 2, expected 1)" refer > to get? > Yes > > 2) Where can I find documentation on get? I would start here:

Re: [Rails] Custom UUID generator

2017-07-10 Thread Matt Hickman
If you look my_uuid_generator() is added to postgres at https://github.com/rails/rails/blob/650ea5e5cf50d8a7242499463cf1762922d330a8/activerecord/test/cases/adapters/postgresql/uuid_test.rb#L186 You can add a stored procedure in a similar fashion in a migration. -- Matt Hickman On Sun, Jul 9,