Data dodania Pytanie
2017-03-01 08:03 nested routes is working different in rails 3.2 and rail 4 »
I am using rails 3.2 and having the following routes resources :projects do resources :assessments end Now when I am using project_assessm...
(0) odpowiedzi
2017-03-01 05:03 Factory Girl: How to create record with has_one_through relationship? »
I have the following relationships as follows class LoanApplication < ActiveRecord::Base has_one :case_status, :dependent => :destroy has_...
(0) odpowiedzi
2017-02-28 16:02 Travis CI error on deploy to Heroku »
Hello Guys I'm using for the first time Travis CI and when i'm getting an error for deploy. The test with Spec works fine but when I watch on Travis f...
(1) odpowiedzi
2017-02-28 16:02 How to migrate existing data after adding polymorphic association? »
After migration my PageViewStats table contains 2 new empty columns: ad_templatable_id and ad_templatable_type. So if I try to query an existing recor...
(1) odpowiedzi
2017-02-28 16:02 Too long is displayed <select> in form »
Guys experiencing the issue with slow display of the input in form. In the variable @cities uploaded about 2 thousand cities, AR request is over the ...
(0) odpowiedzi
2017-02-27 21:02 Rails - Validation :if one condition is true »
On Rails 5. I have an Order model with a description attribute. I only want to validate it's presence if one of two conditions is met: if the curren...
(4) odpowiedzi
2017-02-27 20:02 Kaminari not respecting .per() setting »
@items = @cats + @dogs + @birds @pag_items = Kaminari.paginate_array(@items).page(params[:page]).per(9) puts @pag_items.count 6 The @items array ha...
(1) odpowiedzi
2017-02-27 18:02 Create constant outside of method »
I have a method test in a concern as below module company extend ActiveSupport::Concern included do def test(emp) employees = { '0' =&g...
(1) odpowiedzi
2017-02-26 21:02 Setting up associations / db references rails 4 »
I have a table called bills. Bills has_many sponsors and has_many cosponsors. Both sponsors and cosponsors contains a list of congress people. I also ...
(1) odpowiedzi
2017-02-26 18:02 Ruby On Rails - how to compromise the modularity of the code? »
I was in an interview for an internship last week and I was given a part of ruby on rails code of a controller. Then the interviewer asked me to "comp...
(0) odpowiedzi
2017-02-26 13:02 Rails how to hide only default locale in url, but show others »
Is it possible to hide the default locale in the url, but show the locale in the other languages? Say, 'de' is my default locale, my login url should...
(0) odpowiedzi
2017-02-26 08:02 create calls before_save multiple times »
I have a before_save callback in my model which encrypts 2 fields before they're saved to the database. class Account < ActiveRecord::Base befor...
(1) odpowiedzi
2017-02-26 00:02 How to reload my index page »
I have this filter in my tutos index: = simple_form_for :query, url: tutos_path, method: :get, wrapper: :inline_form, html: {class: 'form-inline'} ...
(2) odpowiedzi
2017-02-25 11:02 Rails index order and group »
I have a Products Controller where in the index action products are sorted by the "cost" column using this code: @products = Product.order(:cost) ...
(1) odpowiedzi
2017-02-25 10:02 How to create model with Association data in Rails 4 »
Model class Product < ActiveRecord::Base has_many :tags has_many :images has_and_belongs_to_many :categories, :join_table => :products...
(1) odpowiedzi
2017-02-25 08:02 How to ignore extra params while creating model record in Rails 4? »
#Creating Products class CreateProducts < ActiveRecord::Migration def change create_table :products do |t| t.string :name t.strin...
(1) odpowiedzi
2017-02-24 21:02 How can I define an after_add method on the relation class instead? »
I have a Character class and a Siblingship class. To denote that one character is a "sibling" of another, I save a Siblingship instance with a charac...
(2) odpowiedzi
2017-02-24 20:02 Extending the shopify_api gem in rails to retrieve resources only available for Shopify Plus users »
In the Shopify API documentation, the resource "User" is offered for those who pay for the Shopify Plus account. See below: https://help.shopify.com/a...
(1) odpowiedzi
2017-02-24 06:02 How to convert png image into autocad format in ruby on rails? »
I am converting png image into autocad format(.dxf).But after conversion png to dxf .Image is not opening in autocad software. Code for convert PNG i...
(1) odpowiedzi
2017-02-24 06:02 Getting asset not loading issue after deployment via Capistrano Linux AMI »
We are facing the issue on the staging server. The steps are as below which we have followed to deploy the application on the staging server. Actuall...
(0) odpowiedzi
2017-02-24 06:02 Rails 4 Sidekiq cannot find the ActiveRecord Objects at all »
I am using Rails 4.2.6 and sidekiq 4.2.2. I am getting an error always that says 2017-02-23T07:33:23.455Z 31886 TID-ovz89uiyg WARN: {"class":"Active...
(0) odpowiedzi
2017-02-24 06:02 find average of json field in postgres rails »
id name overview created_at 1 john { 'keywords' => '10' } 2017-02-11 04:55:23 UTC 2 robert { 'keywords' => '20' } 2...
(0) odpowiedzi
2017-02-23 21:02 How to write into different tables when rails model has been inherited? »
I have the following models: class Building < ActiveRecord::Base;end class Department < Building;end class Organization < Building;end W...
(1) odpowiedzi
2017-02-23 17:02 Confusing difference between `count` and `size` »
I have a has_many :through relationship between Product and Order: So I create a new @order and assign it a product like so: @order = Order.new(prod...
(2) odpowiedzi
2017-02-23 09:02 How to take screenshot of googlemap from web page using PhantomJs? »
My Requirement is to take screen shot of Google Map of web page.I am drawing Markers and Polyline dynamically on Google Map.I am using PhantomJS for ...
(1) odpowiedzi
2017-02-23 09:02 Finding True value in rails »
I have a table called DueAction and it has an reference of DueEmployeeDetail.I need to update is_confimed column of DueEmployeeDetail only when all th...
(1) odpowiedzi
2017-02-23 03:02 capistrano rails app has parent folder in git »
using cap '3.7.2' and rails 4.2. Our rails app in in git with a parent folder, so in the git repo there is parentfolder/app instead of app at the root...
(1) odpowiedzi
2017-02-22 22:02 How to create a unique link to some page? »
I need to generate an unique link, so that when user clicks on it, they end up on some page/action. However, they can't go directly to that page/actio...
(1) odpowiedzi
2017-02-22 19:02 Rails 4- Flash messages are not showing »
After I am trying to display a flash message on my contact page. Here is my code def contact_us UserMailer.delay.contact_email(params) flash[:not...
(2) odpowiedzi
2017-02-22 18:02 Rails 4 Tests running in "development" environment by default »
We are porting a Rails 3 project to Rails 4. Our tests run fine under Rails 3, environment is correctly defaulted to test. However, when I switch ov...
(0) odpowiedzi
2017-02-22 15:02 Rails: Finding HABTM records that do (or do not) have an association »
I am trying to find a more efficient way to do the following: I have two models in a HABTM relationship and I would like to find all the records in o...
(0) odpowiedzi
2017-02-22 13:02 postgres query explanation for aggregate with group by »
SELECT AVG(CAST(overview ->> 'keywords' AS INTEGER )) FROM reports GROUP BY DOMAIN; I have this in an existing project. I need to know what exa...
(1) odpowiedzi
2017-02-21 22:02 map concern hash keys with the table column »
I created a concern in model module Employee extend ActiveSupport::Concern included do def job job_hash = { '0': 'A', ...
(1) odpowiedzi
2017-02-21 14:02 Ruby on Rails: Search collection_check_boxes on a form »
In my RoR application I have functionality that allows a user to select contacts to send an email to. I want to add to this functionality so that a us...
(1) odpowiedzi
2017-02-21 14:02 LoadError: cannot load such file -- minitest/rails »
I am using Rails 4.2 and Ruby 2.1.3, while running unit test cases with the following command rake test /../test/models/file_test.rb --trace I am g...
(2) odpowiedzi