Data dodania Pytanie
2017-01-09 15:01 How to create objects using rails polymorphic association »
I want to create objects using Polymorphic association but it returns me error like: NoMethodError (undefined method `new' for nil:NilClass): Here ...
(1) odpowiedzi
2017-01-09 12:01 How to get data from 2 tables based on search keyword rails »
I have 2 tables schools and private_schools and they are not related to each other. What I need to do is to search the data from both tables to popula...
(3) odpowiedzi
2017-01-09 11:01 Redmine : error in running redmine_wktime plugin : rufus-scheduler-3.0.3 »
I'm using redmine 3.3.1 and i wanna install the plugin "redmine_wktime" DOCUMENTATION of the plugin : https://github.com/dhanasingh/redmine_wktime, ...
(1) odpowiedzi
2017-01-09 11:01 rails mysql regex input not getting sanitized properly »
I am doing the following on a rails 3 app def test(str) User.where("name REGEXP ?",str).last end Using the format above, rails generally handle...
(1) odpowiedzi
2017-01-09 04:01 Rspec: controller spec login helper »
I am using rspec to test my controllers. The problem is that I need a login helper method every other controller tests will use in its before(:each) d...
(0) odpowiedzi
2017-01-09 02:01 What exactly was initialize_on_precompile used for? »
I'm having trouble understanding what initialize_on_precompile was used for. What exactly did it mean for it to be false (especially as it relates to ...
(1) odpowiedzi
2017-01-08 23:01 Why in Rails table fields are defined in migrations but not in models? »
I am studying Ruby on Rails and confused with structure of files and code.. Why in Rails table fields are defined in migrations but not in models? I k...
(1) odpowiedzi
2017-01-08 21:01 Add custom directive for strftime in ruby »
I would like to add a %custom directive to strfime that will translate months to the code used in some financial/trading reports January => F Feb...
(1) odpowiedzi
2017-01-08 19:01 In Ruby, can I check if a string contains a letter without using regular expressions? »
I'm using Rails 5. I want to know if a varaible (which you can assume is a String) contains at least one letter (upper case or lower case). However,...
(3) odpowiedzi
2017-01-08 18:01 ruby on rails : <top (required)>': superclass must be a Class (Symbol given) (TypeError) »
In my rails server, this error occurs when I enter 'rails console production' and I don't know why. What I'm trying to do is generate user information...
(2) odpowiedzi
2017-01-08 16:01 Ruby on Rails update_attibutes not working »
I am trying to set an user as admin, the method is: def set_user_admin if admin_true? == true user = User.find(params[:format]) if us...
(2) odpowiedzi
2017-01-08 08:01 Not sure how this code reads »
I'm browsing github looking at cool code, but don't understand what this code does: I understand that there are 2 belongs_to associations, but I don'...
(2) odpowiedzi
2017-01-08 05:01 Ruby on Rails - Need Help Optimizing My horrible code involving multiple data models »
I am working on a personal project and I have hit a wall. I know I am writing bad code and I really wan to refactor the code below. The application ha...
(1) odpowiedzi
2017-01-07 22:01 what is the named constructor equivalent of the literal constructor for the Range class? »
somewhat new to rails. I am working through the exercises on 4.4.1 in Michael Hartl's learn rails tutorial and i'm a bit unclear as to what the named ...
(2) odpowiedzi
2017-01-07 22:01 Rails: How to include multiple web fonts into rails asset pipeline using bower? »
I want to include multiple custom web fonts to my rails asset pipeline and the fonts are not loaded. My folder structure: In my application.rb fil...
(1) odpowiedzi
2017-01-07 21:01 Rails Alternative to use polymorphic associations »
I've see that the polymorphic association break the rules of relational db design and in the end cause more harm to the app. so, the left alternative ...
(1) odpowiedzi
2017-01-07 20:01 Active Record has many through, create and delete symmetry »
Users have many Groups through Memberships. Groups have many Users through Memberships. Joining a group is essentially creating a Membership between t...
(2) odpowiedzi
2017-01-07 18:01 Using an ActiveRecord class_name with pluck issue »
I have a model: class Entry < ActiveRecord::Base belongs_to :organization belongs_to :detail_organization, class_name: "Organization" end an...
(1) odpowiedzi
2017-01-07 14:01 Rails Form Check Box or select Array value for multiple arrays »
I'm maintaining a Rails 3.2.22.5 legacy app and creating a form to send messages internally to users (in this case they are called medics). Here is w...
(1) odpowiedzi
2017-01-07 06:01 If I schedule a worker to run every day on Heroku, how can I be sure it doesn't run twice or get skipped? »
I'm a bit confused as to how Clockwork, Sidekiq, and Redis all fit together on Heroku given that Heroku restarts dynos at least once a day. Say I hav...
(2) odpowiedzi
2017-01-07 05:01 Testing that Devise is re-sending confirmation instructions email in a background worker »
I want to send Devise confirmation instructions to users a second time if they haven't confirmed within two days of signing up, however I can't seem t...
(0) odpowiedzi
2017-01-07 05:01 undefined method `[]' for nil:NilClass on select_options [Filterrific Gem] »
Hi I am using Filterrific Gem to add searching and filtering functionalities for my users page. The Searching works just fine, but I got undefined me...
(2) odpowiedzi
2017-01-06 22:01 Rails 5: Assets + Bower + Bootstrap Sass »
There are already similar questions on SO, but not enough clear responses to understand the following issue. My goal is to setup Rails 5 with Bootstr...
(2) odpowiedzi
2017-01-06 22:01 Mock Rails 4 application config custom value »
In Rails::Application, I add a custom configuration using... config.x.cache_config = config_for(:cache) In my tests, I want to see how code using t...
(1) odpowiedzi
2017-01-06 21:01 Rails 4 ActiveRecord::first not working »
I'm debugging some legacy code in a Rails 4.1 app and I'm seeing some confusing results from this: #order.rb # get the most recent order from the sa...
(1) odpowiedzi
2017-01-06 20:01 How can I programmatically read metadata from an AWS S3 Object in Rails? »
My app is storing files on AWS S3. When the files are retrieved, some of them are missing a metadata field. I'd like to write a service that lets me...
(1) odpowiedzi
2017-01-06 19:01 I want to get an array of users whose last name begins with 'x' using the Rails console »
I have tried such things as: users=User.where :conditions => "last_name LIKE ?" "%X" and users=User.where("last_name.each_char.first = 'X'") and u...
(1) odpowiedzi
2017-01-06 19:01 Update hash value in class »
Here I have a little demo-code: class UpdateHash def initialize(value) @value = value save end def save @value = 10 end end ha...
(3) odpowiedzi
2017-01-06 17:01 Why url heplers aren't working in tests? »
spec/rails_helper.rb ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) abort("The Rails environment is runni...
(1) odpowiedzi
2017-01-06 16:01 undefined method `attribute_method_matcher' for "":String first THEN NoMethodError: undefined method `has_key?' for nil:NilClass »
Hi I am working on a project via ruby on rails. I have my model defined as hkn_int.rb and point it to field_database table So when I in rails conso...
(0) odpowiedzi
2017-01-06 15:01 How to raise ActiveResource ResourceInvalid exception? »
I want to raise an Active Resource exception manually from RSpec and I am trying to doing something like this- ActiveResource::ResourceInvalid.new(42...
(2) odpowiedzi
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