Ransack : using nest with snake_case table

My models are Menu, MenuDrink and Drink. Association: Menu has_many Menudrinks, and has_many Drinks through MenuDrinks MenuDrink table is an Intermediate table has drink's quantity column. Data Example Menu1 coke:2/ diet coke:3/ water:5 Menu2 co...
more »

2017-10-16 21:10 (0) Answers

Brick FTP upload file using brick_ftp gem

I have trouble with uploading file using brick_ftp gem I am using dropzone.js for front end. This is my source code for uploading BrickFTP::API::FileOperation::Upload.create(:path => params[:file].original_filename, :source => params[:file]) ...
more »

2017-10-16 06:10 (1) Answers

CarrierWave not storing url for uploaded file

I am trying to process my uploaded images (with CarrierWave) in the background (through Sidekiq). Here is my configuration (carrierwave_delay gem): class IconUploader < CarrierWave::Uploader::Base def is_processing_delayed? img = nil ...
more »

2017-10-15 14:10 (0) Answers

Rails: uninitialized constant Controller

Here is my setup: Routes: resources :apps, except: [:index, :new], path: 'a' do resources :platforms, only: [:update] end Controller: class Apps::PlatformsController < ApplicationController before_action :authenticate_user! befor...
more »

2017-10-15 12:10 (1) Answers

Querying in Rails

How can I get the first name and last name from the table User through table Friend which is referenced by the user_id with the condition of user_id 5 and status is pending and place it in a each loop but i also need the contents of friend controller...
more »

2017-10-15 07:10 (3) Answers

Failed to install rails

As title git:(master) ✗ gem install rails ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.4.0/gems/rails-5.1.4/README.md git:(master) ✗ sudo gem install rails Successfully installe...
more »

2017-10-14 18:10 (1) Answers

Disable auto plaintext-only on iOS devices

I have very strange bug. On iOS devices I can't edit my some input fields. I check code and on iOS auto add strange code part into my input. <input type="password"> #document-fragment <div contenteditable="plainttext-only"></di...
more »

2017-10-14 17:10 (0) Answers

How to include a module in a class

A module in my gem is included in a class in another gem, which is extended by a custom class in a Rails app: My gem: module MyGem def my_method end end AnotherGem.send :include, MyGem Another gem: class AnotherGem end Class in Rails a...
more »

2017-10-12 17:10 (1) Answers

Gemset error when updating to Ruby 2.4.2

I'm updating from Ruby 2.0 to 2.4.2 using RVM, and receive the following error messages during an install using $ rvm install ruby-2.4.2: Making gemset ruby-2.4.2 pristine - please wait 'command gem pristine --extensions bigdecimal --version 1.3.0 ...
more »

2017-10-12 17:10 (1) Answers

Rails gem with javascript dependency

I'm writing a rails gem which requires angular, so I added it to my gem's dependencies: s.add_dependency "angularjs-rails", "~> 1.6.2" Now, how should I include angular ? I tried to add it directly in my gem's main js script but sprockets fails ...
more »

2017-10-12 13:10 (1) Answers

Get hash of id => property in Rails

I have an ActiveRecord model like this: class Person < ActiveRecord::Base attr_accessible :name end and need to get a hash mapping Person's ids to their names: {1 => "Paul", 2 => "Aliyah", 3 => ... } Now, the obvious way would be ...
more »

2017-10-11 21:10 (3) Answers

Simple Form - Custom Input Not Being Recognized

So I'm wanting to have a custom input component defined for a simple form and have the following: # app/inputs/gds_input.rb class GdsInput < SimpleForm::Inputs::Base def input(wrapper_options = nil) binding.pry end end And then in a for...
more »

2017-10-11 19:10 (1) Answers