Data dodania Pytanie
2017-11-18 23:11 facebook messenger get started button don't send messaging_postbacks »
Playing around with a dummy facebook app nd ruby on rails to set-up a messenger bot. My goal is to trigger a sign up when the user first interacts wit...
(0) odpowiedzi
2017-11-18 15:11 Date gets changed when saved to DB »
I'm using PostgreSQL and I have a column named reservation_date which type is date. Also, I set my timezone to Tokyo in application.rb I try to save...
(0) odpowiedzi
2017-11-18 15:11 Rails 5 Nested Attributes not saving find_or_initialize_by method »
I'm sure new in RoR and using Rails 5.0.6 (Ruby 2.3.4p301). Below is problem I'm stuck for the past tons of hours with- I have two tables- locations ...
(1) odpowiedzi
2017-11-18 14:11 How to not repeat writing same attributes when using `let` and `create` in nested contexts? »
I have an Rspec test using FactoryBot(FactoryGirl) as follows: describe Note do let(:note) {create(:note, title: "my test title", body: "this is th...
(2) odpowiedzi
2017-11-18 12:11 rails adding /admin to routes when admin logs in »
In my project I have a users model and an advertisements model. The users model contains the admins too. I want to set routes such that when an admin ...
(2) odpowiedzi
2017-11-18 12:11 Rails select in non-table model »
With inspiration from https://github.com/merit-gem/merit i try to build a function that would be called with an after_action in my application_control...
(0) odpowiedzi
2017-11-18 03:11 Rails find records using an array of hashes »
(Select Query by Pair of fields using an in clause) I have an array of hashes that looks like this: [ {product_id: 7629, group_id: 4}, {product_id: ...
(2) odpowiedzi
2017-11-18 00:11 Can't figure out why my form won't update »
In my application a user is created using a telegram bot sending messages to my Rails api. Once a user is created, it can add instagram accounts ass...
(0) odpowiedzi
2017-11-17 21:11 Running an expensive method in the view VS in the controller - Rails »
Running the risk of being tagged as "too broad", but this is an authentic doubt. Say I have @my_model.complex_calculation_result to show in a view. ...
(2) odpowiedzi
2017-11-17 19:11 Rspec swallowing Postgres database exception on create »
I have trouble understanding the behavior of Rspec (rspec 3.7, rails 5.1.4) not throwing exceptions (as expected) related to database constraints. As...
(1) odpowiedzi
2017-11-17 19:11 Evaluating list of boolean methods ruby »
I have a list of methods who if any of them evaluated to true, I have to trigger an action on the model, in this case it's model audit. So for exampl...
(3) odpowiedzi
2017-11-17 18:11 How to join two cache into the Model »
I need to join two list cached into my Model, to build a new cached list I've tried the code below but cached_groups is producing an empty result. A...
(1) odpowiedzi
2017-11-17 17:11 Expire cache fragment not working »
I'm trying to cache a side_bar. Into it, there is two list of groups (1: favorite groups, 2: others_groups) My caching aproach: 1.caching the two li...
(1) odpowiedzi
2017-11-17 16:11 pg_search gem and fulltext search rank setting »
Im using the gem pg_search to perform fulltext search on my postgres db. I've a scope like this: pg_search_scope :fulltext, against: [:firstname, :la...
(1) odpowiedzi
2017-11-17 10:11 update action of a RESTful route in Rails (PATCH or PUT) »
I am a newbie to Ruby on Rails.why is the update action of a RESTful route in Rails is mapped to two HTTP verbs i.e, PATCH and PUT? PATCH /articl...
(1) odpowiedzi
2017-11-16 18:11 Does memoization works with active record relations? »
Let's say i have a method in my model as below. def all_users @users ||= User.all end and I have other method in my model where i am doing all_u...
(2) odpowiedzi
2017-11-16 14:11 Problems setting development environment »
I have a rails 3 app working in a development environment using tmuxinator. like this: for running the server: RAILS_ENV=development bundle exec rai...
(0) odpowiedzi
2017-11-16 11:11 ActiveRecord::SerializationTypeMismatch: attribute was supposed to be a Hash, but was a String »
To get a hash I have this: serialize :colors, Hash But I have an error where it the result of this attribute looks like this: To show this I took ...
(1) odpowiedzi
2017-11-16 10:11 Spree active record object nil when eager loading »
I'm trying to query item and loop through them. The li is not nil but accessing product on it throws NilClass error. Spree::LineItem.includes(:produc...
(0) odpowiedzi
2017-11-16 10:11 Adding enum on model shows error on initializing different class object »
I have added enum on RvDate model as: class RvDate < ApplicationRecord enum status: { Available: 0, Not_Available: 1 } # Associations belongs_...
(3) odpowiedzi
2017-11-16 09:11 PG::UndefinedColumn: ERROR in case of same DB is used for two different projects which are connected with each other in Rails »
I'm running two projects as a different repository with git. One is admit another one is Web in rails, both are connected with each other, Basically s...
(2) odpowiedzi
2017-11-16 09:11 Rails sending one email to many with :bcc VS sending multiple emails one at a time with :to »
I have to send batch emails to several hundred site members. It seems there are two decent Rails ways: The easy way using :bcc Where we send 1 ema...
(0) odpowiedzi
2017-11-16 05:11 send_file vs html5 download attribute »
It looks like the HTML5 download attribute is supported on every browser now, and I was wondering if there are any advantages/disadvantages to using t...
(1) odpowiedzi
2017-11-16 05:11 Rspec: Run specific unit test on every model unless whitelisted »
I have a multi-tenant SaaS app. I run a tenant security test on every tenant model. describe 'tenant security' do it "has only the current company...
(2) odpowiedzi
2017-11-16 00:11 Mocking Rspec any_instance_of method return value relative to instance's actual args »
I'm running into an issue where I'm trying to mock out an async method in a service class, but I want the result set to be based on the inputs to the ...
(1) odpowiedzi
2017-11-15 23:11 Return even if more associations than scope asks »
I have Users and Languages tables, joined by LanguagesUsers. LanguagesUsers stores the language_id, user_id, and level. Users can have unlimited Langu...
(1) odpowiedzi
2017-11-15 23:11 Heroku: unable to connect to chromedriver 127.0.0.1:9515 when using Watir/Selenium »
This runs locally (without specifying driver_path), but not on Heroku. Code: Selenium::WebDriver::Chrome.driver_path = ENV['GOOGLE_CHROME_SHIM'] bro...
(1) odpowiedzi
2017-11-15 20:11 Confused about Ruby on Rails routes.rb syntax »
Suppose I had the following code in my routes.rb file. get '/dashboard', to: 'dashboard#index', :as => 'dashboard' I know what's going on (a ...
(3) odpowiedzi
2017-11-15 20:11 How to better optimize large query using raw SQL or Arel »
This post may frighten many of you, maybe especially the most senior craftsmen. Let's just say that being new to programming applications like this I ...
(0) odpowiedzi
2017-11-15 20:11 Multitenant Rails model Inheritance »
My multi-tenant "Customer" model represents data from multiple tables in a "org_#{current_user.org.id}_customers" pattern (i.e. org_1_customers, org_2...
(1) odpowiedzi
2017-11-15 12:11 ActionCable raising exception during rspec system spec »
I have a problem using ActionCable with system specs using Capybara. ActionCable is working perfectly on my development server, but when testing wit...
(0) odpowiedzi
2017-11-15 01:11 Rspec testing fail strong params »
Trying to get this one to pass for a while, not that familiar with Rspec, tried couple answers, and no luck yet, I have these two parameters being req...
(1) odpowiedzi
2017-11-14 23:11 How do I reference my service class from rspec? »
I'm using Rails 5 and trying to test a service using rspec. I created my "spec" directory per the instructions and placed my test file in there, whic...
(0) odpowiedzi
2017-11-14 22:11 Rails controller testing: Testing in isolation or integration? »
I'm a bit confused when testing Rails controller, whether to test them in isolation(mocking, less DB hits: faster), or in an integration way(no mockin...
(3) odpowiedzi
2017-11-14 22:11 Rack custom middleware giving error "ActionDispatch::Http::Parameters::ParseError" »
I am writing a custom middleware for my rails app, to decrypt/encrypt parameters in a post request. I have configured the middleware in 'config/enviro...
(1) odpowiedzi