Data dodania Pytanie
2017-05-20 03:05 Defining custom ActiveRecord creators through associations »
I have some models with a has_many and belongs_to associations between them similar to below: class Customer < ActiveRecord::Base # attributes i...
(2) odpowiedzi
2017-05-19 18:05 Rails InvalidForeignKey »
I am developing a portfolio for my website, I decided to add skills to each portfolio item. class PortfolioSkill < ApplicationRecord belongs_to...
(1) odpowiedzi
2017-05-19 05:05 Rails has one association »
I am working on building a portfolio section in my website right now. I have it set where a portfolio has one category that is associated with it. ...
(3) odpowiedzi
2017-05-18 11:05 How to use OR in ActiveRecord Rails 4.1.1? »
I'm used scope where(address: [nil, ''], city: [nil, '']) and I get request WHERE ((`address`.`address` = '' OR `address`.`address` IS NULL) AND (`a...
(2) odpowiedzi
2017-05-17 07:05 rails5&activerecord: how to properly seed&save polymorphic associations »
This ought to be a pretty basic question but I'm stuck right now. I have these models: class Character < ApplicationRecord has_one :inventory, ...
(0) odpowiedzi
2017-05-16 10:05 Rails set has_many value dynamically »
I have an entity: book of class Book. The entity class has has_many relation with other tables, pages for example. Let's say that page_1 and page_2 ...
(2) odpowiedzi
2017-05-15 17:05 Namespaced Model Associations Error Column not found »
I want to create a M2M Association for two models, one is in a different namespace than the other, when I try to access the methods added by has_and_b...
(0) odpowiedzi
2017-05-12 19:05 Query against a Postgres array column type »
TL;DR I'm wondering what the pros and cons are (or if they are even equivalent) between @> {as_champion, whatever} and using IN ('as_champion', 'wh...
(1) odpowiedzi
2017-05-11 10:05 Find child resources' total attachment storage usage - Paperclip Rails »
I am building a rails app which has the models Users, Album (as in photo album) and Photo, nested in that order. I want to be able to find the total s...
(1) odpowiedzi
2017-05-08 09:05 Insert in DB array checkbox rails »
Need help for array insert in db using check box. <% @companies.each do |company| %> <%= check_box_tag 'company_name[]', company.company...
(3) odpowiedzi
2017-05-08 03:05 creating active record using no of hashes in rails »
I am getting a no of hashes in my controller which are submitted as part of form data.The form basically contains a list of tasks ie task name ,task t...
(1) odpowiedzi
2017-05-06 23:05 Rails. Migration enum with "t.cloumn..." or "t.integer"? »
Sometimes in a migration file I see: t.column :model_type, :integer, default: 0, null: false and sometimes: t.integer :model_type, default: 0, nul...
(1) odpowiedzi
2017-05-05 21:05 hacking gitlab - adding a field to the issue model »
So I find myself needing to add a "custom" field (an external ticket ref) to the gitlab issue model. Not being a ruby guy, I've been kinda fighting t...
(1) odpowiedzi
2017-05-05 10:05 Is there any difference where we specify includes in Rails activerecord »
I am surprised with includes method behaviour. let's take example case 1: User.includes(:organizations, :category, subscriptions: :plan).coaches ...
(0) odpowiedzi
2017-05-04 17:05 Why isn't schema.rb formatted correctly in rails 5.1.0? »
Previously schema.rb was a good place to quickly see what column defaults were and whether or not they could be nullable, but now it's messy. For exam...
(1) odpowiedzi
2017-05-03 16:05 If I name a table sizes will it conflict with the method sizes? »
I was working on a project where I named a table sizes and I was having a lot of difficulty and errors, though I can't remember the specific errors I ...
(0) odpowiedzi
2017-05-03 08:05 Rails - sort by parents attribute »
I have the following 2 tables Table "public.friendships" Column | Type | ------------+-----------------------------+ id...
(1) odpowiedzi
2017-05-03 05:05 How to write a case insensitive query and only return unique records in Rails »
I am using Rails 4 and PostgreSQL and trying to figure out a way to write a case insensitive query method that returns records such that you get only ...
(1) odpowiedzi
2017-05-02 20:05 Rails 4 ActiveRecord associations: updating collectionproxy via Rails console »
Trying to understand how to do this via Rails console. Subscription - has many categories Category - belongs to subscription There were 9 categories...
(2) odpowiedzi
2017-04-30 09:04 undefined method `admn_no' for nil:NilClass »
I have two models Scorecard and Result The relationship between the two is; class Scorecard < ActiveRecord::Base belongs_to :results class ...
(1) odpowiedzi
2017-04-29 14:04 How to set up a relationship between a user and all other users? »
I'm creating my first Rails app to learn the basics, and it's a simple matchmaking site. I'm trying to design the way the users will associate with e...
(0) odpowiedzi
2017-04-28 16:04 ActiveRecord Rails 4.2 - Filter includes query »
I'm trying to improve some queries in my Rails 4.2 project. One query in particular, is done in an API Controller. The query is as follows (just as ex...
(0) odpowiedzi
2017-04-25 13:04 Rails 5 - Connectivity issue with MS SQL 2008 »
I am trying to build a ROR app with Ruby 2.3.3 and Rails 5.0.1 but when connecting to SQl server 2008 I am getting an error which says TinyTDS::Er...
(0) odpowiedzi
2017-04-25 12:04 Scope/query based on a specific instance of an has_many associations »
Let's say I have a Person class with many transaction_records. How do I retrieve all the Person which have their last transaction_record(based on cre...
(1) odpowiedzi
2017-04-25 01:04 Select data from 4 tables using Active Record Class in CodeIgniter »
I want to select data from 4 tables using Active Record class in codeIgniter My tables: Teacher(id_teacher, name) Student(id_parent, name, id_teacher...
(1) odpowiedzi
2017-04-21 22:04 Rails advanced Active Record query »
I want to do an advanced Active Record query on my models through a join and count all the records. I don't know whether it's possible to do what I wa...
(2) odpowiedzi
2017-04-21 17:04 Join Two Result Sets in Rails 4 »
How do you perform a left outer join on two ActiveRecord::Relation results in rails? Given: sales = DailySaleItem.joins(:daily_sale).where("daily_sa...
(0) odpowiedzi
2017-04-21 09:04 Unpermitted parameter when trying to update record »
I have two models, ProjectCategory and ProjectQuestion. A ProjectCategory can have many questions related to it, and a ProjectQuestion can only have o...
(1) odpowiedzi
2017-04-20 15:04 More than one enum value for an attribute »
Suppose I have the following very simple code snippet enum role: [ :admin, :enginier, :medic, :user ] I want one of my users to have the role of [:a...
(1) odpowiedzi
2017-04-19 02:04 Rails undefined method `name' for nil:NilClass and I don't get why »
Hi guys I am developing a system I created on RoR My idea is that a person can attend to serveral events, So I have 3 tables: Person, event, and atte...
(2) odpowiedzi
2017-04-17 11:04 Apply validations on attribute when a function with same name exists »
chats Schema: create_table "chats", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer "chat_type", limit: 2, ...
(1) odpowiedzi
2017-04-15 23:04 Type Casting a Column to bigint in Padrino Active Record »
I have upgraded to the latest Ruby on a Padrino application and I am having errors with active record when creating a new object. It's validating a nu...
(1) odpowiedzi
2017-04-15 19:04 How do I create/register a User model that has a belongs_to relation? »
I want the user to confirm their email before they add/edit their profile (it's a really big profile). On the POST /users(.:format) devise/regist...
(1) odpowiedzi
2017-04-15 10:04 Creating a nested model instance (has_many relation) on the view of its parent model »
I have a model A und a model B and the relation is A has_many B (and B belongs_to A). I have a model, a controller and views for A and only a model fo...
(1) odpowiedzi
2017-04-12 04:04 A better way to get ActiveRecord table's primary tables(belongs_to' tables) array »
I have a table with many fields [ [ 0] "id", [ 1] "type", [ 2] "title", [ 3] "delivery_fee", [ 4] "price", [ 5] "starting_pri...
(1) odpowiedzi