Data dodania Pytanie
2018-02-15 12:02 rspec post:create action ArgumentError: unknown keyword: post »
This is my FactoryBot file as post.rb FactoryBot.define do factory :post do title 'Rspec Test' text 'test for attributes' user_id 1 ...
(1) odpowiedzi
2018-02-15 09:02 Problems with paperclip on Rails 5 »
I've created a new project with Rails 5.0.0 and Ruby 2.5 on my local mac with macOs 10.12. Now I'm trying to add paperclip to this project but still ...
(1) odpowiedzi
2018-02-13 11:02 how to call action from model to controller in ruby on rails »
I am trying to call 'checking' action from post model. class Post < ApplicationRecord after_commit :testing def testing @id = ...
(4) odpowiedzi
2018-02-12 21:02 How do I build a link_to tag that takes a stirng ID instead of a numeric id? »
I have a routes question concerning Rails 5. I have this in my config/routes.rb file resources :votes The "show" method in my VotesController ca...
(1) odpowiedzi
2018-02-12 10:02 Ruby on Rails: Active-Record sort and put specific row to the top »
I have an Active record one -> many association and I need to get all child rows starting with a specific row something like parent.children.star...
(2) odpowiedzi
2018-02-12 05:02 PG::ForeignKeyViolation: ERROR: update or delete on table "xxx" violates foreign key constraint »
I have several tables that have foreign key constraints associated with them, each referencing the other in a hierarchical fashion as outlined below. ...
(1) odpowiedzi
2018-02-05 15:02 Relationship model between users, companies and introductions »
Apologies for the newbie question but I am completely stumped on this one. I have two models, user and company, and I am trying to establish a "reque...
(1) odpowiedzi
2018-02-05 14:02 Model with a read only, dependant attribute? »
I have a model that has two attributes: A ast-attribute (jsonb) that contains a complex data structure and a compiled-attribute (string) that can be r...
(1) odpowiedzi
2018-02-05 11:02 Rails, polymorphic association. Destroy with "touch: true", useless steps »
I'm on Rails 5. I have a polymorphic association like this: models/enjoy_level.rb: class EnjoyLevel < ApplicationRecord belongs_to :enjoyable,...
(1) odpowiedzi
2018-02-04 10:02 trying to create a one to one relationship »
I am trying to create a one to one relationship to which i thought i understood... I have my user table and a profile table which should be linked w...
(2) odpowiedzi
2018-02-02 21:02 Simple calculation not working before save, Rails »
I've got a base_price field, a shipping_price field, and a total_price field. It's a simple base_price plus shipping_price equals total_price. For so...
(4) odpowiedzi
2018-02-02 13:02 subclass_from_attributes works fine? »
I have several classes inherited with STI with the replacing of inheritance_column in a kind of classy way: module A class Base < ActiveRecord::Ba...
(1) odpowiedzi
2018-02-02 11:02 How to return the most recent children unique by parent with ActiveRecord »
A post has_many comments. A comment belongs_to a post. I'm trying to get back a list of the most recent comments, but only one per post. The followin...
(1) odpowiedzi
2018-02-01 18:02 How do I mock an OmniAuth hash using Rails and minitest? »
I'm using Rails 5 with minitest. I want to mock logging into my sessions controller, which relies on omniauth (I use Google and FB for login). I hav...
(1) odpowiedzi
2018-02-01 14:02 Cannot create many-to-many relationship »
I connot create a many to many relation in ruby on rails. I always get an error when i try to save a new Glossary. "Glossary categories is invalid" ...
(1) odpowiedzi
2018-02-01 00:02 How do I define a variable that all my views can access? »
I have a Rails 5 web app (almost). I want to include an attribute on all my views. I read somewhere that the way to do this was to define a helper m...
(1) odpowiedzi
2018-01-31 22:01 In Rails, how do I write a finder method ordering by a column I don't want to return? »
With Rails 5, how do you write a finder that orders by a column that you don't necessarily want to return? I have Person.select("id, name").order('v...
(2) odpowiedzi
2018-01-30 19:01 How to refactor Rails 'params' method »
Hello there is simple pattern to deal with params security but it makes a lot of mess in Controller Can i do anything with it ? def report_params p...
(2) odpowiedzi
2018-01-27 22:01 Why can't Rails find a gem that I clearly specified in my Gemfile? »
I'm using Ruby 2.4 with Rails 5.0.1. I'm confused about why Rails says it can't find a gem. I get this error when visiting a page Specified 'postgr...
(1) odpowiedzi
2018-01-27 00:01 Rspec and commit callback giving an incorrect result »
I have a User and Role model: class User < ApplicationRecord has_and_belongs_to_many :roles validates :roles, presence: true, on: :save aft...
(1) odpowiedzi
2018-01-25 11:01 CSRF detected error message on refreshing webpage »
I am working on a Rails application where details are fetched from facebook. I have fetched the details from facebook. But when I refresh the webpage ...
(2) odpowiedzi
2018-01-23 23:01 Converting params to JSON and passing as argument to ActiveJob »
I'm upgrading a rails 4.2 app to Rails 5 and I'm no longer able to pass params like [:members][:contact_ids] into ActiveJob. I've tried to convert t...
(1) odpowiedzi
2018-01-21 23:01 Create fresh Rails 5 credentials on clone »
Problem I am creating a rails 5.2 template. I've created a new project which is a fork of the template. I don't want to use the same config/master.key...
(1) odpowiedzi
2018-01-19 00:01 Rails: as_json ignoring parameter »
I'm trying to make a "not simple" query using ActiveRecord: ChatRoom.first.as_json(include: { chat_room_members: { include:{ ...
(1) odpowiedzi
2018-01-18 23:01 Gem file is requesting dependencies that are installed when upgrading from Rails 4 to Rails 5 but it says it could not find compatible versions »
This is my first major upgrade of Rails (v4 to v5). I've done minor upgrades, like 4.1.1 to 4.2 etc... I've upgraded to 5.1.1, and I'm getting this ...
(2) odpowiedzi
2018-01-18 19:01 Upgrading to Rails 5 and rspec 3.7 no longer sends emails via ActionMailer::Base.deliveries »
I had a functional spec suite using rspec with a Rails 4.2.8. I upgraded to Rails 5.0.6 and rspec 3.7 accordingly. Many of the specs work, but none ...
(0) odpowiedzi
2018-01-15 20:01 Find all Users that bought their car before they were 18 »
I want to find all Users that bought their car before they were 18. I need a query like this: User.includes(:car) .where(car: { bought_at < (...
(1) odpowiedzi
2018-01-15 19:01 Use Rails 5.2 ActiveStorage to create and save pdf and later attach to email »
I am afraid i am getting something completely wrong with the new active storage feature. What I want to do is to create an pdf ( I am using WickedPdf ...
(1) odpowiedzi
2018-01-14 14:01 Ruby on Rails 5.1 from helper_method can not get Data in View »
I am new in RoR and i am using helper_method to pass data from ActiveRecord. My code is follow: class ApplicationController < ActionController::B...
(1) odpowiedzi
2018-01-14 05:01 Rails 5 Rspec set session variable »
I have a request test spec which tests a POST request. In my PaymentController (which handles the POST request), i have before_action :require_user...
(0) odpowiedzi
2018-01-11 14:01 Rspec expect view file by name »
I would like to know if Rspec has any expect to check the render view file by name. This is my situation: I have a method with if and else conditions...
(1) odpowiedzi
2018-01-11 03:01 How can I test omniauth-facebook in rails 5 with minitest »
I read previous possible questions that may have the answer but that not what I asked for. First of all I am start to use test. However I already suc...
(1) odpowiedzi
2018-01-11 01:01 Listing users who have posts with Ruby on Rails 5 »
Currently I have this query to pull all users who have an avatar: @users = User.all.order('RANDOM()').where.not(avatar: nil) However I also need to...
(2) odpowiedzi
2018-01-06 23:01 Ruby on Rails: Help in multiple image upload using paperclip with different process »
I have 3 models: Post, Comment, and Image (I am using paperclip gem BTW) What I am trying to achieve is that users can comment on post. Also, if the...
(1) odpowiedzi
2017-12-30 05:12 Rails - username lowercase validation »
My app validates username based on whether it's lowercase or uppercase. This is the validation I currently have: format: { with: /\A[a-zA-Z0-9]+\Z/ },...
(2) odpowiedzi