Questions tagged [ruby-2.1]

For issues relating to development in Ruby, version 2.1. If your question applies to Ruby in general, use the tag [tag:ruby].

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Ruby 2.1 was released on Dec 25, 2013.

For information on Ruby in general, visit .

222 questions
1
vote
1 answer

role based route authentication

I have been using devise and cancancan for authentication and authorisation resp., resque for background jobs. I have been following Ryans screencast number 271 and saw below code snippet for routes.rb file. authenticate :admin do mount…
codemilan
  • 1,072
  • 3
  • 12
  • 32
1
vote
1 answer

Unicorn: [FATAL] Failed to create timer thread: Resource temporarily unavailable

We have use Gitlab for our version control system. But the unicorn service was crash tonight with ps -ef | grep unicorn I can not see any processes about unicorn when I want to start it using nohup bundle exec unicorn -c config/unicorn.rb -E…
Zoker
  • 3,849
  • 1
  • 12
  • 12
1
vote
1 answer

authorizing specific controller action using cancancan

I have link to access player's load_player view to access player that belongs to current_user. So how can i restrict access to load_player method for current_user that has no belonging club or club belonging to other user. Note I want restrict…
codemilan
  • 1,072
  • 3
  • 12
  • 32
1
vote
2 answers

Ruby regex to match a pattern followed by another pattern

I already have a regex to match only single digits in a comma-delimited string. I need to update it to match the strings like following: 5|5,4,3 2|1,2 , 3 The constraints are it should start with a single digit in range of 1-5, followed by a…
Jignesh Gohel
  • 6,236
  • 6
  • 53
  • 89
1
vote
0 answers

Checking the contents of an empty directory over FTP raises exception

I am not sure what I am missing, but I have FTP connection that I have to download the contents (if any). I run the following code: connection.nlst('*.*').each do |entry| connection.getbinaryfile(entry, downloaded_file_path) end The…
Tom Rossi
  • 11,604
  • 5
  • 65
  • 96
1
vote
2 answers

Rails, Prawn PDF Gem - undefined method `table' for

Rails 4.1.1 Ruby 2.1.2 Gemfile : gem 'prawn', '~> 2.0.0' I have PDF's working ok. I am now trying to add table in the pdf. But when i add table I get the following error... undefined method `table' for XPDFClass I tried adding... require…
polarcare
  • 575
  • 1
  • 6
  • 24
1
vote
1 answer

jquery-datatable, ajax-datatable-rails or filterrific?

I'm really confused what to use for serverside pagination, filtering, sorting etc. which is good to use (jquery-datatables, ajax-datatables-rails or filterrefic gem.
roarfromror
  • 276
  • 1
  • 2
  • 11
1
vote
0 answers

rspec-rails 2.1.6 stops working in Ruby 2 for some reason

My specs work fine in ruby 1.9.2. But after upgrading to Ruby 2.1.5, when I run a spec, I get the following error: $ rspec…
1
vote
1 answer

unable to install Gosu library in Ruby in Linux

I am getting this error when I am trying to install gosu on Ubuntu 13.10 Fetching gem metadata from https://rubygems.org/......... Fetching version metadata from https://rubygems.org/.. Resolving dependencies... Using diff-lcs…
Sadiksha Gautam
  • 5,032
  • 6
  • 40
  • 71
1
vote
1 answer

Ruby Timestamp Reliably Convert To UTC

I am writing a Ruby script. It needs to accept time stamp from the user and then do some database queries using it. As far as I know the database is storing timestamps in UTC. I want to let the users specify the time in following format: 2015-01-01…
septerr
  • 6,445
  • 9
  • 50
  • 73
1
vote
1 answer

Ruby 2.1 with erubis Template Engine

We are looking for fastest template engine for rendering of views. As i understand erubis is the fastest template engine in ruby. My usecase is render templates through script. Looking at the gem official page it's latest release was in 2011. Not…
abrocks
  • 171
  • 13
1
vote
0 answers

Upgrading Ruby breaks UI

I am trying to upgrade to Ruby 2.1.2 from 1.9.3 for my Rails app. The problem I am facing is that the app's UI styling and layout has been destroyed by the upgrade. I can only see a white page with the UI elements (text boxes, select boxes) minus…
341008
  • 9,862
  • 11
  • 52
  • 84
1
vote
2 answers

Mail gets send from smtp username setting not from "from" method in ActionMailer rails

In user_mailer.rb class UserMailer < ActionMailer::Base default from: "email.1@gmail.com" def approved_mail(user) @user = user @greeting = "Hi" mail to: @user.email end end And in development.rb …
roarfromror
  • 276
  • 1
  • 2
  • 11
1
vote
0 answers

Adding devise confirmable module within web api or any other technique for same functionality?

I would like to add devise confirmable functionality to web service, I would like to know steps to integrate it, code in registration_controller.rb :- class Api::RegistrationsController < Devise::RegistrationsController skip_before_filter…
roarfromror
  • 276
  • 1
  • 2
  • 11
1
vote
1 answer

Ruby on Rails Passenger on Apache gemfile syntax Error ID 506682d5

Running Rails 4 on Apache2 using Phusion Passenger and Ruby 2.1 installed via RVM. When I access the Rails app in the browser, I get this error: Gemfile syntax error compile error on line 24: syntax error, unexpected ':', expecting $end gem 'sdoc',…
Romi
  • 123
  • 10