Questions tagged as 'ruby'

1
answer

Remove elements out of standard deviation

I have the following array [123, 350, 3456, 98] and I need to remove items out of standard deviation, such as 3456 . I already have the standard deviation calculation as below: class Array def average return 0 unless self.size &g...
asked by 14.04.2015 / 16:25
1
answer

Using Ruby on Rails is it possible to execute external functions on the client side?

Example: On the computer that has the browser accessing the page, with the proper permission, execute a function on a DLL installed on it? Complementing: My intention was to use it on an intranet, and access a printer using the DLL provided b...
asked by 28.12.2014 / 22:47
1
answer

How do loops and variables work in jekyll?

When I compare in if if post.category is as if there was no post variable that is no longer when I put {{post.category}} it prints the name. It's as if in if it does not exist anymore if I put site.post.category in if...
asked by 24.02.2015 / 15:24
2
answers

How to use HATBM with various models

I will have the model Tag it will have relationship HABTM with POSTS . But I want it to also have HABTM relationship with USERS because my goal is in the future to find posts that have the same tags as the us...
asked by 01.12.2014 / 02:14
1
answer

Partial does not render with 'enter' using Ajax

I have an ajax that fires when the page loads: /assets/javascript/itens.js : if ($('#content-recommendation').length) { xhr = $.ajax({ url:'/get_recommendations/' + gon.item_id + '.js', type:"get" }); } views/items...
asked by 01.09.2014 / 03:39
1
answer

Redis in Rails 4

I have an Item template. Can you save Item.all (Item :: ActiveRecord_Relation) in Redis? I tried to do so: $redis = Redis::Namespace.new("suggestme", :redis => Redis.new) $redis.set("itens", Item.all) But when I give: $redis.get("iten...
asked by 25.08.2014 / 22:27
1
answer

SideKiq for multiple domains

I have a production server that will contain multiple clients, and I want to add the sidekiq to manage the image processing queues. However, I do not know how it behaves for multiple domains, that is, does each system have a queue, or will all...
asked by 14.10.2014 / 22:11
1
answer

Dynamic fields using Sinatra

In Rails this is a relatively simple task. But I did not find anything in Sinatra's documentation stating that it was possible. I want to add fields to a form dynamically. User clicks a link and a new field is added. If desired, click on another...
asked by 09.08.2014 / 12:23
1
answer

How to pass parameters dynamically to Rails?

I have a rather complex problem to the extreme. I need to somehow pass parameters dynamically to the params via javascript, to show / hide some fields in a report on user's request. Below is a screen representation: I have a form where th...
asked by 30.10.2014 / 12:31
1
answer

Gem strong parameters not installed

I'm having trouble adding a gem in my project, the gem strong parameters. My version of ruby on rails is 4.1.4. I do not know what's going on. When I give bundle install  WhenIgiveabundleupdatethisappears     
asked by 16.08.2014 / 17:17