Data dodania Pytanie
2017-11-15 20:11 Multitenant Rails model Inheritance »
My multi-tenant "Customer" model represents data from multiple tables in a "org_#{current_user.org.id}_customers" pattern (i.e. org_1_customers, org_2...
(1) odpowiedzi
2017-11-15 18:11 rake db:migrate - PG:: InvalidSchamaName ERROR: no schema has been selected to create in »
I am attempting to run a rake:db migrate on a postgres database for my rails application. rake:db drop (the db already existed I am fixing a bug that ...
(2) odpowiedzi
2017-11-15 09:11 select2, simple_form and acts_as_taggable_on »
I am trying to add tags to a model. I need it to function with the following features: Rendered as tags in the view using select2 User can create th...
(1) odpowiedzi
2017-11-14 22:11 Uncaught TypeError: $(...).aaDropdownMenu is not a function »
I am working on a Ruby on Rails 4.2 application and using foundation 6 Sometimes as I am navigating through the app I get a turbolink error and the h...
(0) odpowiedzi
2017-11-14 22:11 Rack custom middleware giving error "ActionDispatch::Http::Parameters::ParseError" »
I am writing a custom middleware for my rails app, to decrypt/encrypt parameters in a post request. I have configured the middleware in 'config/enviro...
(1) odpowiedzi
2017-11-14 21:11 How to get unique/distinct values in included in render json »
I'd like the instituciones values to be unique/distinct when rendering profesionales. The model is as shown: class Profesional < ApplicationReco...
(1) odpowiedzi
2017-11-13 23:11 how to pass same parameter multiple times in ruby »
I have following index method in ruby def index if params.key?(:item) @items = Item.get_items.where(item: params[:item]) else @items = It...
(1) odpowiedzi
2017-11-13 19:11 Eager loading sibling records without including self »
For serialization I want to include an array of sibling records which shares a common foreign key. I currently have the following: class Foo < Act...
(1) odpowiedzi
2017-11-13 16:11 Generate XML file and redirect to other view with Rails »
I have a piece of code that generates an XML file. What I want to, and didn't find the solution, is to generate the XML file and ALSO redirect to anot...
(1) odpowiedzi
2017-11-13 12:11 Stripe payment with rails »
I'm looking for a way to send money from my stripe account to someone's debit card. Does anyone know of an API that allows me to do this? I am use str...
(1) odpowiedzi
2017-11-13 10:11 How to routes to a specific controller with a variable value ahead of it in rails 5? »
Normally its like: resources :users To keep a value ahead we can do like scope :url do resources :users end but, issue is that I have the just ...
(1) odpowiedzi
2017-11-13 08:11 Implement directory system in rails »
I want to implement directory system in my rails app. User will have some abilities to manipulate directory. Create new folders and delete them. Use...
(0) odpowiedzi
2017-11-12 23:11 Processing pgSQL query results in batches »
I've written the rake task to perform a postgreSQL query. The task returns an object of class Result. Here's my task: task export_products: :environ...
(1) odpowiedzi
2017-11-12 20:11 ActiveRecord finder method #where not filtering query results »
TL;DR: Why am I receiving a list of all resident's when I'm using class methods to scope between active & inactive residents? My application use...
(2) odpowiedzi
2017-11-12 16:11 Rails paperclip error undefined method `before' for false:FalseClass when attaching image to model »
I have a model named Question that I want to attach a file to (diagram) using Paperclip (5.0.0). When the model is saved I get this error: undefined...
(1) odpowiedzi
2017-11-12 15:11 Rails loop thru attachments and show the first »
I have implemented a basic search and I would like to show each result aligned with an image. I'm using the carrierwave gem on my app and trying loop ...
(1) odpowiedzi
2017-11-11 22:11 undefined method `find_by_friendly_id' with FriendlyId gem and Rails 5.1 »
I want to prevent selecting user with his id and that's why I am using this method which should work in this way, but instead I am getting this error:...
(1) odpowiedzi
2017-11-11 17:11 Calling models and their methods in external scripts »
I'm trying to access an activerecord model using rails runner. I passed the following: rails runner "TabAccount.find_by_id(1).screen_name". I know thi...
(1) odpowiedzi
2017-11-11 02:11 Count distinct records while plucking from another table »
Given Rails app where: class Team < ActiveRecord::Base belongs_to :captain, class_name: User I'm trying to succinctly query database and get a...
(2) odpowiedzi
2017-11-10 14:11 Rails ActionController::Live without restart server on developpement »
I'm using SSE (Server Sent Event) in rails with the ActionController::Live of rails 4. It's working fine. But in developpement, I have to defined my ...
(1) odpowiedzi
2017-11-10 11:11 Rails: Loop thru two different models »
I have implemented a basic search and I'm looping thru the results like this: views/items/search.html.erb <% if @items.present? %> &lt...
(1) odpowiedzi
2017-11-10 04:11 Can a rails application identify when a request is from curl? »
A rails application can use the request object to access user agent and more data about the request. How to detect browser type and its version But ...
(1) odpowiedzi
2017-11-09 22:11 Build list of plucked attributes from belongs_to association »
Active Record ninjas, Jumping between languages I've forgotten how to do this: I'm looking for a concise Rails way to get attributes out of an associ...
(2) odpowiedzi
2017-11-09 16:11 Rails: How to send json response immediately for long running job »
I am processing long running jobs. i am invoking long running method from controller. i want to send json response immediately to the user. below is ...
(1) odpowiedzi
2017-11-09 15:11 Ruby on rails big decimal value format not correct »
Big Decimal not showing value in numbers a = BigDecimal.new("100.55") a = * a * a puts "big decimal #{a}" output big decimal [#<BigDecimal:ad5...
(1) odpowiedzi
2017-11-08 21:11 avoid losing the value of variable sessions »
in my view index I am showing a table with multiple records, each record has a checkbox where it has the id like this <td> <%= chec...
(0) odpowiedzi
2017-11-08 18:11 Sum all values from JSON response »
I have a JSON response that looks like this: { "km" =>"32.381", "tarifa" =>25.6 }, { "km" =>"23423", "tarifa" =>2...
(2) odpowiedzi
2017-11-08 11:11 change AASM state through edit action »
I'm using AASM to manage states in my User model. I want to change the status through the edit action. To do this I'm using the method User.aasm_sta...
(1) odpowiedzi
2017-11-07 12:11 inserting scores data into a quiz_user join table »
I am working on a quiz app and I have to keep track of users along with the quizzes that they appeared for any their score for that quiz so I thought ...
(1) odpowiedzi
2017-11-07 10:11 Rails how to change url for seo »
i am coding a news website. I'm trying to implement best seo practices. For seo , post urls should be like : ( i use friendlyId gem ) www.mywebsite...
(1) odpowiedzi
2017-11-07 00:11 rails difference between two dates inside .where »
Here is my logic I want to get the closest 4 more expensive mobiles to a specific mobile @mobile but under one condition the difference between the re...
(2) odpowiedzi
2017-11-05 03:11 Rails: will_paginate with multiple models »
I am having a really hard time figuring this one out and I'm hoping someone else has had to do something similar before: I have two models: class De...
(0) odpowiedzi
2017-11-04 12:11 Modified checkout form for a signed in user of Spree based application »
Im new to using Spree . We are using Solidus which is a fork of Spree 2.4. I would like to customize the checkout flow in my application. For a signed...
(1) odpowiedzi
2017-11-04 01:11 How do I validate a model based on the attributes of an association? »
In Rails4, I have a model that belongs to another model. How do I validate based on the value of an attribute in the parent model? In a food menu sy...
(1) odpowiedzi
2017-11-03 20:11 how to run rake db:migrate on irb »
I am trying to run a migration script on irb but it returns syntax error. irb(main):008:0> rake db:migrate:up VERSION=20171006190045 SyntaxError: ...
(3) odpowiedzi