Data dodania Pytanie
2016-12-19 23:12 NameError, uninitialized constant »
I'm trying to submit a simple form using rails. class BibliographiesController < ApplicationController def creer #this has been localized for ...
(1) odpowiedzi
2016-12-19 04:12 Rails/Ruby... 50mb string performance »
I'm trying to send 1mm rows worth of data to the browser. Unfortunately this is a situation where I can't use pagination. The actual raw PG query ta...
(3) odpowiedzi
2016-12-19 00:12 undefined method `request' for true:TrueClass »
I have an app structure with nested routes in which a proposal belongs to a request and a request has many proposals. When I execute a send_proposal ...
(1) odpowiedzi
2016-12-18 06:12 how to delete not saved data but i have assigned this data with build or new in rails? »
I have assigned record like this profile_image = current_user.profile_images.build(params_profile_image) But I don't want to save this record any ...
(1) odpowiedzi
2016-12-16 15:12 How to select all records having an attachment? »
I'm using rails4 with paperclip. On one of my forms I would like to list only the records of a resource having a paperclips attachment. Is there any ...
(1) odpowiedzi
2016-12-16 12:12 Using foreign_key in rails associations has_many »
Could somebody explain me is my code correct. I'm trying to get foreign_key option in rails associations. I have 2 models: Book and Author Book db ...
(1) odpowiedzi
2016-12-16 01:12 Which find gives better performance in Rails, Child.find(child_id) or parent.children.find(child_id)? »
I have 2 models. For the purpose of this Q&A I call them Parent and Child. # Parent.rb class Parent < ApplicationRecord has_many :children, ...
(2) odpowiedzi
2016-12-15 13:12 unable to insert data using custom action by belongs with has many relationship rails »
My relationships are: class PrivateClass < ActiveRecord::Base has_many :lesson_plans end class LessonPlan < ActiveRecord::Base belongs_to...
(1) odpowiedzi
2016-12-15 11:12 Why HABTM relation entries are not cleared after a destroy in Rails? »
I was wondering why I have to write this (following) code to clear the relation table after destroying one of the two elements joined in a HABTM relat...
(0) odpowiedzi
2016-12-13 11:12 Rails: Filter nested attribute in scope »
My models have the following relation: Building has many Rooms that have many Beds that have many Accommodations, and I want to render all Buildings...
(2) odpowiedzi
2016-12-12 22:12 Rails 5: (Object doesn't support #inspect) when serializing text column »
I'm building a rails 5 api only app, working with a postgres database created from a rails 4 app. In rails 4, I could easily include serialize :colum...
(0) odpowiedzi
2016-12-12 01:12 AR with sqlite3: Does setting limits on columns have any effect on db size? »
Im a bit new to AR and Sqlite. I'm working with a big dataset and struggle to figure out what's good practice for optimizing db speed and size. Eg. ...
(1) odpowiedzi
2016-12-09 09:12 Rails 5 Return all records and include necessary association »
So we have such case (many to many through): class Company < ActiveRecord::Base has_many :contracts has_many :subscribers, through: :con...
(1) odpowiedzi
2016-12-09 00:12 How to display both a link and link name from a database using rails 4 »
I would like to display a link from the database and also the link name also saved in the db.I am using rails 4 and haml. Any ideas how I can achieve ...
(4) odpowiedzi
2016-12-08 17:12 Rails 4 nested has_many with where clauses along the way »
The relationship is as follows. Client -> has_many :analytics Client -> has_many :metrics, through: :analytics Analytic -> has_many :metrics...
(1) odpowiedzi
2016-12-08 03:12 Too many checks for empty params. How to optimize queries to ActiveRecord in Rails5? »
I'm doing checks for empty parameters before do the query. There is only 1 check for params[:car_model_id]. I can imagine if I will add more checks fo...
(1) odpowiedzi
2016-12-07 19:12 Using Paranoia gem, set deleted_by user attribute with callbacks or in controller »
I am using the paranoia gem on Rails 3.2.19 (old I know, will be moving to Rails 4 at some point). My goal is to not only soft delete objects, but al...
(0) odpowiedzi
2016-12-07 17:12 Sort users based on most recent response to a particular answer in a survey? »
I'm trying to sort users based on their most recent response to a certain question in a survey using Rails 5, PostgeSQL 9.4.5 So far I've got: User....
(1) odpowiedzi
2016-12-07 15:12 Does ActiveRecord make a new database connection per model »
I'm trying to understand how ActiveRecord connects to a database on a per model basis. So lets assume we have 2 models and one database. When you do a...
(1) odpowiedzi
2016-12-06 21:12 Rails ActiveRecord Includes with Inner Join »
When doing using includes on an ActiveRecord model, is there a better way to specify an inner join then: User.includes(:address).joins(:address) It...
(0) odpowiedzi
2016-12-06 02:12 Where I should put a complex sql on a rails project? »
I would like to know what is the best way to keep in maintenance and call a complex query due to using Active Record is not a good practice to call st...
(0) odpowiedzi
2016-12-05 07:12 What is the conceptual difference between User.first.followers.count and User.first.followers.to_a.count? »
The two Active Record queries: User.first.followers.count and User.first.followers.to_a.count evaluate to the following SQL queries respectively: [4]...
(0) odpowiedzi
2016-12-03 22:12 Update a Rails model with AJAX »
I'm barely just starting to learn AJAX. My current ajax function doesn't seem to be having any effect. Here is the function from my coffeescript file...
(1) odpowiedzi
2016-12-03 16:12 join tables in RoR »
I have the following two models. class ResponseMap < ActiveRecord::Base has_many :response, foreign_key: 'map_id', dependent: :destroy belongs_to ...
(3) odpowiedzi
2016-12-02 18:12 Rails scopes downcase before searching »
I'm trying to create a scope to search the model in a case insensitive way. scope :services_offered, -> (service) { joins(:my_services).where(my_s...
(1) odpowiedzi
2016-12-01 20:12 Rails computation on large table »
I'll try to explain my problem. I've created a table which represents something like text model for the user(user_models) based on purchases. I have a...
(2) odpowiedzi
2016-12-01 08:12 Shopify Restore Deleted product »
I am working on application which interact to Shopify::API.I want to remove unnecessary (Quite OLD) product.It i will run ShopifyAPI::Product.delete(I...
(1) odpowiedzi
2016-12-01 00:12 Reference joining row in a has_many :though association »
I have a common has_many :through association between three tables and I would like to be able to either request to include the joining row as it's ow...
(0) odpowiedzi
2016-11-30 21:11 Why is ActiveRecord leaving off the last element when parsing a string as data for an array attribute? »
I'm using Postgres. I have an ActiveRecord model with an integer array column, like so: t.integer "foo", array: true If I assign a ruby array to it...
(0) odpowiedzi
2016-11-30 17:11 Multiple Associations With the Same Table (Many-to-Many) Ruby on Rails »
I am trying to figure out the best way to accomplish a relationship and having some trouble. I have come across a few articles that somewhat address w...
(1) odpowiedzi
2016-11-30 16:11 active record query order where first »
I am using c9 cloud ruby on rails and rails version is 5.0.0.1 I want to use active record query to select best rating restaurant and not have been ...
(2) odpowiedzi
2016-11-29 19:11 Rails "logic" seems to be alluding me »
Well, as usual I've tied myself into another knot with rails "logic", and am frustrated beyond belief. If I could pull this off in regular SQL it wou...
(1) odpowiedzi
2016-11-28 16:11 Callback run at a datatime specified in the rails database »
I have a rails API that has a Transaction ActiveRecord model. When a transaction object is created, it withdraws the money from your account if there ...
(0) odpowiedzi
2016-11-28 13:11 Rails STI accept_nested_attributes »
I have model STI like this: #base model class Field < ApplicationRecord end #child model module Fields class Text < Field end end #child ...
(0) odpowiedzi
2016-11-27 19:11 Select simple value in ActiveRecord »
I want to show a text summary for a model in a Rails application. Currently I'm doing it like this: class ServiceOrder < ApplicationRecord has_...
(1) odpowiedzi