How to use ActiveRecord aggregate functions with time zones? | Fixed issues |
- How to use ActiveRecord aggregate functions with time zones?
- Get absolute path of image saved by paperclip in Serializer of rails
- Render Highcharts inside Webix
- Get actual project in hook?
- Javascript TypeError: variable is undefined
- Can't install because I don't have high enough Ruby version, but I do
- How to write validation for enum in rails
- How do you merge two jquery posts into one in coffeescript?
- Gem load error when trying to use RinRuby
- devise bug! devise_for :installs bug
- In Rails, how to call an AJAX function and then refresh page when its complete?
- How to test that JSON-only controller returns 406
- How to rewrite this ActiveRecord qurey to MySQL?
- How to negate a scope? [duplicate]
- C Stack usage error while using RSRuby with rails
- error while rails s, and i have nodejs
- Display Errors For Nested Form
- Unable to deploy Rails App to DigitalOcean because of unsupported key type
- How to use subdomain with ActiveAdmin on rails
- Rails, align dynamic elements using bootstrap
- factory_girl, transient attribute creates two records
- Missing PaperClip Image
- Rails: Refile gem (attachment_image_tag prints wrong URL)
- Why am I getting singleton cant be dumped err?
- How to print JSON object in browser console, using ruby controller?
- Sphinx (ThinkingSphinx) with no down time?
- Rails5 migration: can't quote Array
- after_update callback calls on page refresh
- Cannot display image inside email in rails
- Remove white space from params
How to use ActiveRecord aggregate functions with time zones? Posted: 15 Aug 2016 08:31 AM PDT This: returns a value of type returns a value of type What is the rational for this? From the docs:
So what is the proper way of using ActiveRecord aggregate functions with the correct time zone - appending |
Get absolute path of image saved by paperclip in Serializer of rails Posted: 15 Aug 2016 08:25 AM PDT I am saving images using Paperclip, while writing an API I need to get absolute path of image instead of relative path. I have tried dozen of ways but they didn't worked, Actually How to get absolute path in serilaizer??? |
Render Highcharts inside Webix Posted: 15 Aug 2016 08:06 AM PDT I'm rendering Highcharts chart in the Rails app like this and it works fine: However, I want to show this chart inside Webix scrollview. Now my code looks like this and is not working (no errors, only blank space where the chart should be): I would appreciate any ideas on how to make it work. |
Posted: 15 Aug 2016 07:53 AM PDT I'm trying to create my first Redmine plugin. Actually i'm trying to create a form in the issue sidebar (the To get the current user, we can do this Now, i want to get the project of the current issue, do you know how to get it ? as Thanks a lot |
Javascript TypeError: variable is undefined Posted: 15 Aug 2016 08:07 AM PDT presently I am working on a Ruby on Rails app, and I am trying to get the below JS to work with the app. The first issue I came across was turbolinks 5.0 was preventing the page from loading the JS on initial load, and I would have to refresh the page in order to load the below JS. I did some googling, and came across this stackoverflow answer, but I can't seem to get the JS to run properly without throwing an error. Any and all help would be greatly appreciated. orders.js |
Can't install because I don't have high enough Ruby version, but I do Posted: 15 Aug 2016 08:10 AM PDT I'm trying to add a widget to a dashboard. I've cloned the widget to the correct directory and copied files over to the relevant locations. The final thing to do is run this line: Everything goes well until I get line : So I've installed that separately: But when I try to run "bundle install" I get the same error. I even checked by ruby version, and its high enough: What am I doing wrong? Is it choosing to use a lower version of ruby? |
How to write validation for enum in rails Posted: 15 Aug 2016 08:38 AM PDT I have an enum in one of my model in my api I want to have validation for this enum but i can not do that . I wrote a validation in my model for that but it did not take any effect |
How do you merge two jquery posts into one in coffeescript? Posted: 15 Aug 2016 07:53 AM PDT I need to merge these two objects: + into one object that can be sent as the [DATA] in a $.post: $.merge only gives swim_lane_id and an id that is part of the update-url data tag but doesn't give the serialized data from the sortable list. I basically need to be able to pass these through in one post because the update-url data tag routes to a controller action in my Rails application and I need to know which list is being updated for every update action sent to it. |
Gem load error when trying to use RinRuby Posted: 15 Aug 2016 08:02 AM PDT I am trying to use the RinRuby gem, but when trying to fire up my rails server I get the following error: I have R installed and my .bash-profile file looks like this: I added this bash file, because I also noticed that I am not able to execute R scripts from the CLI using Rscript, but I have to include the whole path I also tried to edit my path with the following: but this didn't help |
devise bug! devise_for :installs bug Posted: 15 Aug 2016 07:27 AM PDT cannot run the command line /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/nokogiri-1.6.8/lib/nokogiri/nokogiri.bundle: [BUG] Segmentation fault at 0x00000000000418 ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin14.0] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/CrashReporter * /Library/Logs/CrashReporter * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. -- Control frame information ----------------------------------------------- c:0046 p:-17556424632272 s:0145 e:000144 TOP [FINISH] c:0045 p:---- s:0143 e:000142 CFUNC :require c:0044 p:0020 s:0139 e:000138 BLOCK /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/nokogiri-1.6.8/lib/nokogiri.rb:32 c:0043 p:0149 s:0136 e:000135 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/nokogiri-1.6.8/lib/nokogiri.rb:28 [FINISH] c:0042 p:---- s:0134 e:000133 CFUNC :require c:0041 p:0060 s:0130 e:000129 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/loofah-2.0.3/lib/loofah.rb:3 [FINISH] c:0040 p:---- s:0128 e:000127 CFUNC :require c:0039 p:0015 s:0124 e:000123 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/rails-html-sanitizer-1.0.3/lib/rails-html-sanitizer.rb:2 [FINISH] c:0038 p:---- s:0122 e:000121 CFUNC :require c:0037 p:0023 s:0118 e:000117 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/sanitize_helper.rb:3 [FINISH] c:0036 p:0025 s:0116 e:000114 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/text_helper.rb:32 c:0035 p:0011 s:0113 e:000112 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/text_helper.rb:29 c:0034 p:0011 s:0111 e:000110 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/text_helper.rb:6 c:0033 p:0025 s:0109 e:000108 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/text_helper.rb:4 [FINISH] c:0032 p:0038 s:0107 e:000105 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/form_tag_helper.rb:18 c:0031 p:0011 s:0104 e:000103 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/form_tag_helper.rb:14 c:0030 p:0011 s:0102 e:000101 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/form_tag_helper.rb:8 c:0029 p:0041 s:0100 e:000099 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/form_tag_helper.rb:6 [FINISH] c:0028 p:---- s:0098 e:000097 CFUNC :require c:0027 p:0031 s:0094 e:000093 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers/form_helper.rb:4 [FINISH] c:0026 p:0391 s:0092 e:000090 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers.rb:50 c:0025 p:0011 s:0089 e:000088 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers.rb:4 c:0024 p:0017 s:0087 e:000086 TOP /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/actionview-4.2.6/lib/action_view/helpers.rb:3 [FINISH] c:0023 p:0012 s:0085 e:000083 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/sprockets-rails-3.1.1/lib/sprockets/rails/context.rb:7 c:0022 p:0011 s:0082 e:000081 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/sprockets-rails-3.1.1/lib/sprockets/rails/context.rb:6 c:0021 p:0011 s:0080 e:000079 CLASS /Users/lironbarkalifa/Desktop/recipe_box/vendor/bundle/gems/sprockets-rails-3.1.1/lib/sprockets/rails/context.rb:5 Any ideas what to do? |
In Rails, how to call an AJAX function and then refresh page when its complete? Posted: 15 Aug 2016 07:37 AM PDT I have a form where I if a user changes the value in one of the drop-down-lists then it needs to change some controls on the form. The way it's currently set up...
The current problem is that the reload occurs sometimes before the auto-save method has completed. How can I only reload the page until after the auto-save has fully completed? I don't want to set reports.coffee |
How to test that JSON-only controller returns 406 Posted: 15 Aug 2016 07:57 AM PDT I have a controller that should only accept application/json or /. I check this in the controller class: That works pretty well, although there is an UnknownFormat error in the log every time a client uses an invalid accept header. The controller correctly returns HTTP 406 Not acceptable. In the test I write: Then Rake aborts with undefined method error at accept_response since the response is nil. I assume it is not set the normal execution flow aborts at the unknown format exception. But if I do not assert the exception the test will just abort with it. Is it a good idea to throw an exception at every 406? How can I test that I get a 406 returned? |
How to rewrite this ActiveRecord qurey to MySQL? Posted: 15 Aug 2016 07:19 AM PDT I have this query from Rails code: and I would need to run this query directly to MySQL console. How to create a MySQL that would does the same as the ActiveRecord above? EDIT: Focus is obviously on how to combine the first and second query, not on how to load the fist query in MySQL. Thank you. |
How to negate a scope? [duplicate] Posted: 15 Aug 2016 06:51 AM PDT This question already has an answer here: Below is a scope that I'm using: Now, I would like to use another I have tried following: Eventually, I had to write following: |
C Stack usage error while using RSRuby with rails Posted: 15 Aug 2016 05:55 AM PDT I try to use RSRuby to execute some R script within my rails project. I created a method inside a module, I call this module from a model and want to store the return value. When I execute this method (from the model > module) using the rails console everything works fine. But when I try to execute this same method within my rails application I get the following error: This error is not related to the R Script (I tried several very simple scripts, but get the same error regardless of the R code I execute). Does anybody have an idea how I could fix this problem? Apart from this error I found RSRuby the most suitable way to integrate R within Ruby, I had other problems when trying to use RinRuby (a gem load error when starting the rails server, because R could not be found). Executing code from the CLI seems inefficient and returns the output as a string, which is in this case also not feasible. |
error while rails s, and i have nodejs Posted: 15 Aug 2016 05:19 AM PDT C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/ runtime.rb:80:in |
Display Errors For Nested Form Posted: 15 Aug 2016 04:55 AM PDT I have a nested form in my view; Here is my Form object (extending Reform); If I submit the form without filling in any fields, then my But there is no "error-looking" HTML on my nested form (the account_type stuff). Name and description are fine (as those are fairly straight forward). But;
How can I address these two points? |
Unable to deploy Rails App to DigitalOcean because of unsupported key type Posted: 15 Aug 2016 05:20 AM PDT I have configured the droplet in DO and nginx is up and running successfully. I followed the guide on DO on deploying to server via Capistrano. I can ssh into the server without entering my password. But on running
I'm using rsa SSH key and this has been working with many (>10) servers seamlessly. I tried to remove the Gem Versions:
|
How to use subdomain with ActiveAdmin on rails Posted: 15 Aug 2016 04:50 AM PDT I'm trying to access the ActiveAdmin with subdomain "admin.localhost.local:3030" instead of namespace "localhost:3030/admin". I looked it up and I found that I should change the default namespace in "config/initializers/active_admin.rb" to false and I surrounded the routes in "routes.rb" with subdomain constraints also, I changed "/etc/hosts" localhost line to be able to test on my machine but for some reason, it still doesn't work. I'm trying to access the subdomain by writing admin.localhost.local:3030 and this is what I get from the browser: "The admin.localhost.local page isn't working. admin.localhost.local redirected you too many times." |
Rails, align dynamic elements using bootstrap Posted: 15 Aug 2016 05:58 AM PDT I'm trying to make my products display view and align them using bootstrap, like in my model. The problem is that, because elements are create dynamically, I can' t do a big bootstap div for all my elements, in order to set an offset, and if I just set my elem size, they are no aligned at all : I displayed them with black background to see better how each div is positioned. How can I do please? |
factory_girl, transient attribute creates two records Posted: 15 Aug 2016 04:38 AM PDT I have the following factories set up factories/request.rb FactoryGirl.define do end factories/customer.rb And I am trying to test that a customer's request is returned with the following Rspec example: Output The last expectation fails as well. It seems like two Request objects are created and |
Posted: 15 Aug 2016 04:21 AM PDT Controller File class HandymenController < ApplicationController before_action :find_handyman, only: [:show, :edit, :update, :destroy] end Model File class Handyman < ActiveRecord::Base belongs_to :user belongs_to :profession has_attached_file :handyman_img, styles: { handyman_index: "250x350>", handyman_show: "325x475>" } validates_attachment_content_type :handyman_img, content_type: /\Aimage/.*\Z/ end ErrorLog Started GET "/handyman_imgs/handyman_index/missing.png" for ::1 at 2016-08-15 10:29:24 +0000 ActionController::RoutingError (No route matches [GET] "/handyman_imgs/handyman_index/missing.png"): actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (4.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (106.1ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (332.3ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (1.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (1.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (1.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (216.2ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (0.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.0ms) Rendered C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (335.3ms) |
Rails: Refile gem (attachment_image_tag prints wrong URL) Posted: 15 Aug 2016 05:48 AM PDT I'm using refile gem for file uploading and I'm uploading files directly to my amazon s3 public bucket. The files are being uploaded just fine to following URL:
I'm using amazon cloudfront to serve these assets from s3, so the cloudfront url, for the asset given above, is something like this:
The both urls when accessed directly through browser works fine. To display this asset in my app view file I'm using refile gem following helper function:
Now the issue is, this helper method prints a URL something like this:
As this URL is different from above cloudfront URL, it is not displaying the image. How do I force |
Why am I getting singleton cant be dumped err? Posted: 15 Aug 2016 04:09 AM PDT When I try to add a variable value into session, I am getting Here is the value in the varibale The variable is an array of objects. I do not know why this is causing an err. |
How to print JSON object in browser console, using ruby controller? Posted: 15 Aug 2016 05:29 AM PDT I want to print a JSON object in the browser's console, I searched a lot but I din't find any appropriate result. Here is my ruby controller: Thanks In Advance |
Sphinx (ThinkingSphinx) with no down time? Posted: 15 Aug 2016 04:06 AM PDT I am currently using Sphinx with ThinkingSphinx gem for Rails. I am using delta indices with scheduled indexing via cron. The problem is, for each deploy, I restart the searchd process (configure before starting again) based off the docs. I deploy around 5 times a day and it's not acceptable for me that search goes down every time I do. Is there really a need to restart sphinx every time? Surely, there is a way to achieve no downtime? |
Rails5 migration: can't quote Array Posted: 15 Aug 2016 04:54 AM PDT I try to migrate my app from Rails 4 to Rails 5 Here is my migration: And model: It worked perfectly in Rails 4, now I have an error: how to solve? |
after_update callback calls on page refresh Posted: 15 Aug 2016 04:13 AM PDT my after update callback calls when i refresh the page and I dont want it to do that. Once i refresh the Room show page the room.availability automatically changes to false. but anytime I refresh the Room's show page, the callback is called even without updating the BookRoom record? Controller rooms controller |
Cannot display image inside email in rails Posted: 15 Aug 2016 05:37 AM PDT I am trying to display my logo inside an email in my rails app. My image is located in assets/images and in the public folder. However my image seem to be never found by the app. How can I include my image in the email ? Here's my layout mailer.html.erb where the image is included inside image_tag |
Remove white space from params Posted: 15 Aug 2016 04:08 AM PDT I have a piece of code which collects params from a form and reads them into invite as I can see. The problem is one of these parameters is an email which I want to ensure has no trailing whitespace. How could I apply strip to invite and all of the params fed into it? |
You are subscribed to email updates from Newest questions tagged ruby-on-rails - Stack Overflow. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment