Data dodania Pytanie
2017-01-06 13:01 How to create migration script for has_many, belong_to association between user and task model in ruby »
I have two model User and Task. Task would have one owner and other as workers. class Task < ApplicationRecord belongs_to :user has_many :...
(1) odpowiedzi
2017-01-06 11:01 rails generate directory recursively »
I am creating a gem which generates directory from template, in my template folder there is one folder which contains files and folder both. But when ...
(0) odpowiedzi
2017-01-06 05:01 Destroy or set global variable to nil, once the browser gets closed in ruby on rails »
I declared a global variable in my rails application controller as $decrypted_attessec = "verified decrypted cookie" and I am accessing it across all ...
(1) odpowiedzi
2017-01-06 00:01 rails controller find record with no associations »
Student has_many enrollments Is there a way to see only students that have no enrollments? Something like: @students = Student.includes(:enrollmen...
(1) odpowiedzi
2017-01-05 23:01 Rails Active Record Query joins only, any »
Student has_many :enrollments With this query I see those students that have true enrollments, but also those that have both, true and false enrollm...
(1) odpowiedzi
2017-01-05 23:01 Sidekiq + ActiveJob callbacks run too fast »
I use Sidekiq with ActiveJob and its callbacks. At the beginning I'd like to say that my problem sounds very similar to this one: https://github.com/m...
(0) odpowiedzi
2017-01-05 22:01 Shorten mapping and concat »
I get an array with person objects. A person can have several houses: person.houses => ActiveRecord_Associations_CollectionProxy Some houses ca...
(2) odpowiedzi
2017-01-05 21:01 Discarding everything in a string variable after the second decimal »
I have a Ruby string variable with the value 1.14.2.ab3-4.dl0.rhel However, I want to discard everything after the second decimal so that I get the va...
(4) odpowiedzi
2017-01-05 17:01 How to find out where a function is overridden? »
In my Rails project, I saw the link_to is overridden in config/initializers/extend_action_view.rb module ActionView module Helpers def link_to...
(2) odpowiedzi
2017-01-05 14:01 Run basic rspec file »
I'm new to Ruby and RSpec. I want to create very simple RSpec test: # test_spec.rb require 'spec_helper' describe TestController do puts(Time...
(2) odpowiedzi
2017-01-05 13:01 Namespacing within `app` directory »
In our app directory, we want some of the sub-directories to contain namespaced classes, and some that contain top-level classes. For example: app/m...
(0) odpowiedzi
2017-01-05 11:01 How is it possible for a legitimate user to submit an invalid CSRF token in Rails? »
Our error logs occasionally contain legitimate form submissions that cause ActionController::InvalidAuthenticityToken errors. My hypothesis is that t...
(2) odpowiedzi
2017-01-05 07:01 How to create a sequential unique id for a db field »
I have the table Slug with the field url which is unique. If I create @slug = Slug.url = "foo" When I go to save, if Slug.url of "foo" already exist...
(5) odpowiedzi
2017-01-05 06:01 Why am I getting this error when I try to install RSpec? »
I have used RSpec before and this is the first time I get this error when I try to run: rails generate rspec:install It results in this error: /Us...
(2) odpowiedzi
2017-01-05 06:01 JS front end update view {not working}? »
When a user creates a note I want that note to save on the back-end and show on the front-end without refreshing the page. DISCLAIMER: I'm bad wit...
(2) odpowiedzi
2017-01-05 05:01 Have access to multiple databases »
I am developing an application that at the beginning the user can select which database to connect to. It is a Rails application which uses Active-Rec...
(0) odpowiedzi
2017-01-05 00:01 Adding presence validation on existing records »
We have user records that have an attribute called first_name. Many of these records do no have the first_name attribute filled out and thus it equals...
(1) odpowiedzi
2017-01-04 23:01 undefined method `provider' for nil:NilClass, RSpec, OmniAuth »
I'm trying to test an authenticated controller with RSpec and OmniAuth. I've followed the integration testing guide on their wiki. When I run the test...
(1) odpowiedzi
2017-01-04 21:01 Logging into application with RSpec »
I am trying to test a controller that has authenticated routes. I'm using OmniAuth with Google OAuth2.0. I followed this guide on the OmniAuth wiki to...
(1) odpowiedzi
2017-01-04 20:01 List the number of records that have X number of associations in has_many »
I have my Person class which will have 0 or more widgets associated class Person < ActiveRecord::Base has_many :widgets end I'd like to list o...
(2) odpowiedzi
2017-01-04 18:01 Sorting in Rails: SQLite vs PostgreSQL »
When I order by a column (id type INT) in Rails 5 with sqlite as the development db, it sorts as expected (1,2,3,4...) but the same thing on my produc...
(1) odpowiedzi
2017-01-04 17:01 Rails Brakeman SQL injection warning while accessing an oracle view/function »
I have rails code that is consuming an oracle view/function. This is my code: def run_query connection.exec_query( "SELECT * FROM TABLE(FN...
(1) odpowiedzi
2017-01-04 17:01 How to remove or edit the pluralization for comments and likes in rails »
I am new to rails, and i am working on a rtl website! I am trying to fix the pluralization in comment.count and get_upvotes.size to be replaced by the...
(1) odpowiedzi
2017-01-04 16:01 Invalid Authenticity Token When Multiple Tabs Open »
I have a Rails 4.2 application. Several months ago we started experiencing Invalid Authenticity Token errors. I've discovered that the following scena...
(0) odpowiedzi
2017-01-04 14:01 Querying hstore with exists? »
I have a column as postgres hstore, and want to query it with exists? in my model. I am using Model.where("column ? :key", key: "xxx").count but ...
(1) odpowiedzi
2017-01-04 14:01 Displaying Status In View - Rails »
In my rails application I have a model called JobPosting. A job posting has a status, it can be either: Waiting Approval Draft Open Interviews Sche...
(2) odpowiedzi
2017-01-04 13:01 warning: constant ::Fixnum is deprecated When generating new model »
First time poster here.I've tried to find solutions online for this but couldn't find anything I could relate to my. All related code: $ rails gener...
(2) odpowiedzi
2017-01-04 13:01 has_many relationship using FactoryGirl »
I'm trying to create instance with has_many relationship using FactoryGirl factories and fail. I have two classes: Computers and NetworkCards. Each Co...
(2) odpowiedzi
2017-01-04 11:01 Rails TimeZone issue - Group query »
I have my server in NYC and the data in PostgreSQL is stored in UTC but all my data on the presentational layer is to be shown in IST I have the foll...
(0) odpowiedzi
2017-01-04 11:01 After Ruby 2.4 upgrade - error while trying to load the gem 'uglifier' (Bundler::GemRequireError) »
I've just upgraded my App to use Ruby 2.4.0 without any errors during the bundling process. When I try to start my server, however, I get the followin...
(1) odpowiedzi
2017-01-04 11:01 Rails and RSpec: Testing controllers with the same name in different namespace (module) »
I have rails 4.1.16 API application that is tested using RSpec 3.4.0, and I experience problems with testing classes called the same name in a differe...
(1) odpowiedzi
2017-01-04 00:01 How do I figure out what is causing Rails to require JSON 1.8.3? »
I'm using Ruby 2.4 on Mac Sierra. How do I figure out what Gem is requiring JSON 1.8.3? Although I haven't specified this gem in my Gmefile, shown b...
(2) odpowiedzi
2017-01-03 23:01 acts_as_follower issue with following users »
I have a User model created in devise: class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, ...
(1) odpowiedzi
2017-01-03 22:01 Passenger Ignoring RAILS_ENV »
Background I've got an env file with various variables depended upon by my Rails app, including RAILS_ENV, which is initialized to development in thi...
(1) odpowiedzi
2017-01-03 19:01 Trying to upgrade to rails 5: Make sure that `gem install pg -v '0.18.4'` succeeds before bundling »
I am trying to update to Rails 5. I have successfully updated Ruby to '2.3.1' in my gem file, and ran bundle install. Then I went for Rails 5.0, and ...
(1) odpowiedzi