Tuesday, March 22, 2016

capybara + coocon dropdown | Fixed issues

capybara + coocon dropdown | Fixed issues


capybara + coocon dropdown

Posted: 22 Mar 2016 06:53 AM PDT

Can't get my head around this.

How do I select the value from dynamically generated (by coocon gem) select dropdown?

I have

accepts_nested_attributes_for :customer_users # in User model  

This is what I have:

visit edit_admin_user_path(@user)    click_link 'add customer'    # following returns true in console, but I have no idea, if it is doing actually anything  find('#customer-users .links .nested-fields select.form-control').select('Accedo AB')  # following line is not working:      expect(page).to have_select('#customer-users .links .nested-fields select.form-control', selected: 'Accedo AB')    click_button 'Submit'  expect(current_path).to eq admin_user_path(@user)  expect(page).to have_content 'Selected Customer has been successfully assigned to user'  

Error:

 Failure/Error: expect(page).to have_select('#customer-users .links .nested-fields select.form-control', selected: 'Accedo AB')     expected to find select box "#customer-users .links .nested-fields select.form-control" with "Accedo AB" selected but there were no matches  

ActiveRecord distinct doest work

Posted: 22 Mar 2016 06:49 AM PDT

I made a Select using Active Record with a lot of Joins. This resulted in duplicate values. After the select function there's the distinct function with value :id. But that didn't work!

Here's the code:

def join_query    <<-SQL      LEFT JOIN orders on orders.purchase_id = purchases.id      LEFT JOIN products on products.id = orders.complete_product_id    SQL  end    def select_query    <<-SQL      purchases.*,      products.reference_code as products_reference_code    SQL  end    result = Purchase.joins(join_query)                   .select(select_query)                   .distinct(:id)  

Of course, neither distinct! or uniq functions worked. The distinct! returned a error from "ActiveRecord::ImmutableRelation" that I don't know what means.

To fix this I did a hack, converting the ActiveRecord_Relation object to an Array and I used the uniq function of Ruby.

What's going on here?

Syntax error, when trying to add value to enum

Posted: 22 Mar 2016 06:41 AM PDT

I have an enum type user_trading_style_char, and it has a few string options, however I'd like to add another one, and came up with this query.

ALTER TYPE "user_trading_style_char" ADD VALUE "copy_trader";  

However it blows up, stating that there's a syntax error at "copy_trader". Not a very helpful error message. Anyone know a way to fix the syntax error or perhaps a better way to add a value to the enum.

Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) - Wercker

Posted: 22 Mar 2016 06:50 AM PDT

I'm using wercker for running specs of my rails app. I have problem with setting up redis on wercker. In my rails app I have redis.rb which looks like this:

if Figaro.env.rediscloud_url    uri = URI.parse(Figaro.env.rediscloud_url)    REDIS = Redis.new(host: uri.host, port: uri.port, password: uri.password)  elsif ENV['WERCKER_REDIS_HOST'] && ENV['WERCKER_REDIS_PORT']    REDIS = Redis.new(host: ENV['WERCKER_REDIS_HOST'], port: ENV['WERCKER_REDIS_PORT'])  else    REDIS = Redis.new  end  

In wercker I set WERCKER_REDIS_HOST enviromental variable to: 127.0.0.1 and WERCKER_REDIS_PORT to 6379

When I start my specs it returns:

 Redis::CannotConnectError:  Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:332:in `rescue in establish_connection'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:318:in `establish_connection'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:94:in `block in connect'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:280:in `with_reconnect'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:93:in `connect'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:351:in `ensure_connected'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:208:in `block in process'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:293:in `logging'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:207:in `process'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:178:in `call_pipelined'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:150:in `block in call_pipeline'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:280:in `with_reconnect'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/client.rb:148:in `call_pipeline'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis.rb:2245:in `block in multi'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis.rb:57:in `block in synchronize'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis.rb:57:in `synchronize'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis.rb:2237:in `multi'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/sidekiq-4.1.0/lib/sidekiq/client.rb:171:in `block in raw_push'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64:in `block (2 levels) in with'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `handle_interrupt'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `block in with'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `handle_interrupt'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `with'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/sidekiq-4.1.0/lib/sidekiq/client.rb:170:in `raw_push'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/sidekiq-4.1.0/lib/sidekiq/client.rb:67:in `push'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/sidekiq-4.1.0/lib/sidekiq/worker.rb:115:in `client_push'  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/sidekiq-4.1.0/lib/sidekiq/extensions/generic_proxy.rb:19:in `method_missing'  # ./app/models/user.rb:26:in `send_reset_password_instructions'  # ./spec/models/user_spec.rb:43:in `block (3 levels) in <top (required)>'  # ------------------  # --- Caused by: ---  # IO::EINPROGRESSWaitWritable:  # Operation now in progress - connect(2) would block  # /pipeline/cache/bundle-install/ruby/2.3.0/gems/redis-3.2.2/lib/redis/connection/ruby.rb:122:in `connect_addrinfo'  

How can I fix that?

How do I theme a Spree website?

Posted: 22 Mar 2016 06:20 AM PDT

I'm creating a spree e-commerce site and was wondering with the current updates to spree how to theme the default pages ( product, home page ) since I can't seem to find the files to do so.

Rails: Bad Associations? [has_many , through] How to test if working?

Posted: 22 Mar 2016 06:32 AM PDT

I am struggling with an issue in my data model. I do have the following models:

class User < ActiveRecord::Base  ...    has_many :claims #user-claims    has_many :claims, through: :rulings, as: :commissars  ...  end    class Claim < ActiveRecord::Base   ...    belongs_to :user    has_many :users, through: :rulings, as: :commissars   ...  end    class Ruling < ActiveRecord::Base      belongs_to :user      belongs_to :claim  end  

Error:

undefined method `commissars' for #<Claim:0xc5ac090>  

Model Explanation:

User can write claims (A claim belongs to one user), and users could do the role of commissars to do the ruling of the claim (max numbers of commissars = 3 per claim).

Is there any way to fix this or improve the relationship?

Date Time Overlape in ROR

Posted: 22 Mar 2016 05:58 AM PDT

In ruby on rails, while booking room for meeting I have four columns:

start_date, start_time,end_date, end_time

so how to get that my booking date and time overlaping with some other date and time

How can I send an ambiguous request in Rails Test Case?

Posted: 22 Mar 2016 05:44 AM PDT

I have the following definitions in my routes:

resources :demands { resources: :solutions }  resources :technologies { resources: :solutions }  

and in my controller test, I want to send two requests:

Get /demands/d123/solutions?technology_id=t123  Get /technologies/t123/solutions?demand_id=d123  

But they both match the same invokes(in SolutionsControllerTest):

get :index, demand_id: d123, technology_id: t123  

it match the first definition in routes.rb, which is

resources :demands { resources: :solutions }  

How should I send both requests in distinct methods?

Filter nested attributes with ruby mongoid gem

Posted: 22 Mar 2016 05:36 AM PDT

I have define the scope below (within my model) to help me filter out certain un-required nested data.

scope :active_inactive, -> { self.in({        state: ["current"],        "events.type" => [          :active,          :inactive,        ]      }).desc(:created_at)     }  

When I run this I get results are contains other events like "in_progress" that this scope should not contain.

rails error on not existing line

Posted: 22 Mar 2016 05:35 AM PDT

I have an file named weekly_report_message.rb with 26 lines of code

module MessageTypes    class WeeklyReportMessage        include Mongoid::Document      include Mongoid::Timestamps        field :last_week_date, type: DateTime      field :this_week_date, type: DateTime      field :runs, type: Integer      field :runs_completed, type: Integer      field :distance, type: Float      field :distance_completed, type: Float      has_one :message        def basic_info        {          :last_week_date => !last_week_date.blank? ? last_week_date.strftime("%Y-%m-%d") : "",          :this_week_date => !this_week_date.blank? ? this_week_date.strftime("%Y-%m-%d") : "",          :runs => runs,          :runs_completed => runs_completed,          :distance => distance.round(1),          :distance_completed => distance_completed.round(1)        }      end    end  end  

this code works ok on local machine and on production server in some cases but there one case in which basic_info method is called and this call results in error (only on production) which says:

undefined method `strftime' for nil:NilClass  app/models/message_types/weekly_report_message.rb:30:in `basic_info'  

but I dont' have 30 lines in this file, the code was deployed, I checked with cat the code on server and is the same as on local, no matter what changes I make in this file it still give me this error, I restarted nginx but still have this error

What is the simplest way to integrate PayPal Express Checkout on an Angular JS/Rails API app

Posted: 22 Mar 2016 05:30 AM PDT

I've got this Angular App which is fuelled by a Rails API. As part of the setup I needed to add Stripe payments for debit/credit cards and PayPal for people who wanted to their PayPal account.

Stripe was a breeze to setup (thanks to a straight forward API and proper documentation) while PayPal is turning out to be the exact opposite.

Starting with their documentation, it is very unclear what methods to use, but after a lot googling the best way forward seems to be sticking with Express Checkout (remember this is just for users who will pay using their PayPal accounts).

It seems I can't do a SetExpressCheckout call via the Angular App directly because I'm getting a CORS error.

So, my question is: Is at all possible to initiate the process via the Angular App or do I need to do it through my Rails API?

If I have to do through the API, is there a tutorial out there anyone can recommend? I've tried those:

Whenever I tried any of the above, I got stuck at one point or another. before pursuing any of the aforementioned approaches further, I'd like to know whether I'm on the right path, so I'd REALLY appreciate if someone could pinpoint whether using the Express Checkout is the best approach and whether is definitely not possible initiate the process (get the token) through Angular. Lastly if there's recent and complete tutorial out there would also be extremely helpful.

Thanks in advance!

Include an association with Active Model Serializer

Posted: 22 Mar 2016 05:29 AM PDT

In a Rails 5 application, I'm using Active Model Serializer 0.10.0.rc4. I want to include a relation in a json hash.

I have this serializer :

class GroupSerializer < ActiveModel::Serializer    attributes :id, :name, :subscription_ids, :nb_places, :description,      :schedule, :course_id  end  

And I'm using it like this :

resource = Group.all  ActiveModel::Serializer.serializer_for(resource).new(resource, include: :subscriptions).as_json  

And I have this :

{"group"=>{:id=>1, :name=>"12", :subscription_ids=>[], :nb_places=>12, :description=>nil, :schedule=>"12", :course_id=>1}}  

I don't understand why subscriptions are not included. I don't want to use has_many in the serializer because it cause infinite loop when the there is multiple rules.

What can I do?

rails refactoring controller code

Posted: 22 Mar 2016 05:26 AM PDT

I have a rails4 app. When a user comments on a post it should send a notification to all the guys who commented on the post and to the post creator. I have a working method in the controller, but it's kinda ugly and I'd like to refactor it.

Could sby tell me what the rails convention for refactoring this?

Comment belongs_to :post, post has_many :comments

create#comment action

if @post_comment.save    ((@post.users + [@post.user]).uniq - [current_user]).each do |post_commenter|      Notification.create(recipient_id: post_commenter.id, sender_id: current_user.id, notifiable: @post_comment.post, action: "commented")    end    ....  end  

Query fetches wrong value and NilClass in rails controller

Posted: 22 Mar 2016 05:25 AM PDT

Hi in the following code although the where query inside create method i.e. variable @count_of_fav_texts_present fetches 1 record in the rails console, but in controller the value of @count_of_fav_texts_present is zero and going inside the first if clause.

Also in the internal if clause the query for find_by i.e variable var_fav_text is giving NilClass. Although when I check it in console the value is not Nil, and it has one record.

I am very new to Rails and I am not sure what mistake I am making. Please help.

class NewfavoriteTextsController < ApplicationController    before_action :set_text    before_action :set_favgroup    before_action :authenticate_user!    def create    @count_of_fav_texts_present = Favorite.where(favorited_id: @text_id, user_id: current_user.id).count      if @count_of_fav_texts_present == 0      if Favorite.create(favorited: @text, user: current_user)        if Newfavorite.create(favorite_group_id: @fav_group, newfavorited: @text)           var_fav_text = Favorite.find_by(favorited_id: @text_id, user_id: current_user.id)           cnt_of_var = var_fav_text.counter           var_fav_text.counter = cnt_of_var + 1           var_fav_text.save        else           # do something        end      else          # do something      end    else      # for condition when var is greater than 0      if Newfavorite.create(favorite_group_id: @fav_group, newfavorited: @text)        var_fav_text = Favorite.find_by(favorited_id: @text_id, user_id: current_user.id)        cnt_of_var = var_fav_text.counter        var_fav_text.counter = cnt_of_var + 1        var_fav_text.save      else        # do something      end    end  end    def destroy    # do something  end    private    def set_text    @text = Text.find(params[:text_id] || params[:id])  end    def set_favgroup    @fav_group = params[:fav_group_id]  end  end  

Thanks in advance.

Option "daysOfWeekDisabled" not working in bootstrap datetime picker

Posted: 22 Mar 2016 05:01 AM PDT

Here it is html I have been using for getting Bootstrap datetimepicker to disable weekend days:

    <div class="input-append datetimepicker4">       <input data-format="yyyy-MM-dd"type="text"></input>      <span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span>       </div>   <link rel="stylesheet" href="http://tarruda.github.io/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">  

Here is the JS I am using :

 <script type="text/javascript">      $('.datetimepicker4').datetimepicker({format: 'dd-MM-yyyy hh:mm' , pickSeconds: false});          $('.datetimepicker4').datetimepicker('setDate', (new Date()));          $('.datetimepicker4').datetimepicker({daysOfWeekDisabled: [0, 6]});      </script>       <script src="http://tarruda.github.io/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"></script>  

Heroku doesn't see gem 'pg'

Posted: 22 Mar 2016 05:37 AM PDT

Need help.

When I try to make user@X220:~/rails_projects/sample_app$ heroku run rake db:migrate

There is a mistake:

Running rake db:migrate on limitless-fjord-69900.... up, run.2816 rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded.
Add gem 'pg' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:177:in rescue in spec' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:174:inspec' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:50:in establish_connection' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:120:inblock (2 levels) in ' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in instance_eval' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:inexecute_hook' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:in block in run_load_hooks' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:ineach' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in run_load_hooks' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/base.rb:315:in' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/base.rb:26:in <top (required)>' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/mysql_database_tasks.rb:8:in' . . .
Tasks: TOP => db:migrate => db:load_config (See full trace by running task with --trace)

My Gemfile is:

'source 'https://rubygems.org'    ruby '2.2.0'    gem 'activerecord', '~> 4.2', '>= 4.2.6'    gem 'rails', '4.2.6'    group :development, :test do        gem 'byebug'      gem 'sqlite3', '~> 1.3', '>= 1.3.11'      gem 'rspec-rails', '~> 2.8'    end    group :test do      gem 'selenium-webdriver', '2.35.1'      gem 'capybara', '2.1.0'    end    gem 'sass-rails', '~> 5.0'    gem 'uglifier', '>= 1.3.0'    gem 'coffee-rails', '~> 4.1.0'    gem 'therubyracer', platforms: :ruby    gem 'jquery-rails'    gem 'turbolinks'    gem 'jbuilder', '~> 2.0'    group :doc do      gem 'sdoc', '~> 0.4.0', require: false     end     gem 'unicorn'    group :development do      gem 'web-console', '~> 2.0'      gem 'spring'    end    group :production do      gem 'rails_12factor'      gem 'pg'    end  

What's wrong?

Can I create JRuby gem to use in original Ruby program?

Posted: 22 Mar 2016 04:47 AM PDT

I used JRuby (9.0) for access to Java Bloomberg API. It need to user from Ruby on Rails application based on original Ruby (2.2.3). How can create JRuby gem for using it from ruby?

Can I set routes by resource method with exclusions in Ruby on Rails application?

Posted: 22 Mar 2016 05:08 AM PDT

Rails guides says that I can write

resources :photos  

in routes.rb.
That will create routes:

  HTTP Verb   Path                Controller#Action   Used for  GET         /photos             photos#index        display a list of all photos  GET         /photos/new         photos#new          return an HTML form for creating a new photo  POST        /photos             photos#create       create a new photo  GET         /photos/:id         photos#show         display a specific photo  GET         /photos/:id/edit    photos#edit         return an HTML form for editing a photo  PATCH/PUT   /photos/:id         photos#update       update a specific photo  DELETE      /photos/:id         photos#destroy      delete a specific photo  

Can I write something like

resources :photos, :exclude => [:edit, :update]  

to get all routes except edit and update:

  GET         /photos             photos#index    display a list of all photos  GET         /photos/new         photos#new      return an HTML form for creating a new photo  POST        /photos             photos#create   create a new photo  GET         /photos/:id         photos#show     display a specific photo  DELETE      /photos/:id         photos#destroy  delete a specific photo  

or I can only write every route manually for expected result?

Ruby On Rails : I need some explanations about form

Posted: 22 Mar 2016 06:45 AM PDT

I am creating a RoR application. So i want to create a web form with select drop down type. I found the following code in a project. Here is a form:

<div class="field">    <%= f.label :key_words %><br>    <%= f.collection_select(:skill_list, User::all_tags, :name, :name, {},{multiple: true}) %>  </div>  

I create in User controller class :

class UsersController < ApplicationController  ...   def all_tags      @tags = Tag.all      end  end  

Here is database :

enter image description here 1. I don't understand what is User::all_tags ? Ok understood 2. I cannot see tags in my select drop down. What is missing ?

How to manually expire rails low cache by namespace

Posted: 22 Mar 2016 05:28 AM PDT

We have:

Rails.cache.fetch("google.com/videos", expires_in: 12.hours) { # some request }  Rails.cache.fetch("google.com/images", expires_in: 12.hours) { # some request }  Rails.cache.fetch("stackoverflow.com/questions", expires_in: 12.hours) { # some request }  

How can I get rails cache be expired by "google.com" key or "stackoverflow.com"?

Updating the cloned element values in db without deleting the Previous cloned field records

Posted: 22 Mar 2016 05:34 AM PDT

I have cloned the div which containing 3 fields. While Im updating those values in the database, im deleting the earlier values and replacing these values using the id. How can i update the column values without deleting earlier record values ?

@pre_data=MgMultiSelect.where(:mg_details_id=>params[:id])    @pre_data.each do |select|    select.is_deleted=1    select.save  end    @selected_data=params[:team_id_new]    if @selected_data.present?      for i in 0...@selected_data.length        @update_data=MgMultiSelect.new()      @update_data.team_id_new=@selected_data[i]      @update_data.mg_details_id=@task_data.id      @update_data.is_deleted=0      @update_data.save      end    end  

Use rake namespace as configuration?

Posted: 22 Mar 2016 04:43 AM PDT

I am trying to create a rake file with tasks for consuming my API. I want to be able and pass a lot of arguments to the task, depending on the call to be used. In an effort to make the tasks easier to use, I want the namespace to be part of the configuration. Is this possible?

namespace :myAPI do        SERVER = 'local'      namespace :live do          SERVER = 'live'      end      namespace :beta do          SERVER = 'beta'      end        BASE_URI = {          live: "https://myapi.com/do/v1",          beta: "https://beta.myapi.com/do/v1",          local: "http://127.0.0.1:4500/do/v1"      }        desc 'Get currently logged users'      task :extract_logged_users => :environment do          get("BASE_URI[SERVER]/users/current")      end    }  

And then I want to be able and run this against the live server for example:

rake myAPI:live:extract_logged_users  

Bundler::GemNotFound with rvm

Posted: 22 Mar 2016 03:51 AM PDT

I'm having a problem with bundler and rvm, I guess.

When I run bundle exec cap production deploy --trace there is shown the following:

deploy@h2540559:/www/apps/foodsoft$ bundle exec cap production deploy --trace  ** Invoke production (first_time)  ** Execute production  ** Invoke load:defaults (first_time)  ** Execute load:defaults  ** Invoke rvm:hook (first_time)  ** Execute rvm:hook  Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.  deploy@biomio-giessen.de's password:my_password ;)  ** Invoke rvm:check (first_time)  ** Execute rvm:check  ** Invoke deploy:set_rails_env (first_time)  ** Execute deploy:set_rails_env  ** Invoke deploy:set_linked_dirs (first_time)  ** Execute deploy:set_linked_dirs  ** Invoke deploy:set_rails_env   ** Invoke deploy (first_time)  ** Execute deploy  ** Invoke deploy:starting (first_time)  ** Execute deploy:starting  ** Invoke deploy:check (first_time)  ** Execute deploy:check  ** Invoke git:check (first_time)  ** Invoke git:wrapper (first_time)  ** Execute git:wrapper  INFO [846cdb3d] Running /usr/bin/env mkdir -p /tmp/foodsoft/ as deploy@biomio-giessen.de  INFO [846cdb3d] Finished in 0.004 seconds with exit status 0 (successful).  INFO Uploading /tmp/foodsoft/git-ssh.sh 100.0%  INFO [568c8ddc] Running /usr/bin/env chmod +x /tmp/foodsoft/git-ssh.sh as deploy@biomio-giessen.de  INFO [568c8ddc] Finished in 0.005 seconds with exit status 0 (successful).  ** Execute git:check  INFO [0875aa52] Running /usr/bin/env git ls-remote --heads git://github.com/foodcoops/foodsoft.git as deploy@biomio-giessen.de  INFO [0875aa52] Finished in 0.381 seconds with exit status 0 (successful).  ** Invoke deploy:check:directories (first_time)  ** Execute deploy:check:directories  INFO [2a11a03f] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/shared /www/apps/foodsoft-production/releases as deploy@biomio-giessen.de  INFO [2a11a03f] Finished in 0.005 seconds with exit status 0 (successful).  ** Invoke deploy:check:linked_dirs (first_time)  ** Execute deploy:check:linked_dirs  INFO [f48755e3] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/shared/bin /www/apps/foodsoft-production/shared/log /www/apps/foodsoft-production/shared/tmp/pids /www/apps/foodsoft-production/shared/tmp/cache /www/apps/foodsoft-production/shared/tmp/sockets /www/apps/foodsoft-production/shared/vendor/bundle /www/apps/foodsoft-production/shared/public/system /www/apps/foodsoft-production/shared/public/assets as deploy@biomio-giessen.de  INFO [f48755e3] Finished in 0.004 seconds with exit status 0 (successful).  ** Invoke deploy:check:make_linked_dirs (first_time)  ** Execute deploy:check:make_linked_dirs  INFO [ada594dd] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/shared/config /www/apps/foodsoft-production/shared/config /www/apps/foodsoft-production/shared/config/initializers /www/apps/foodsoft-production/shared/config/initializers as deploy@biomio-giessen.de  INFO [ada594dd] Finished in 0.005 seconds with exit status 0 (successful).  ** Invoke deploy:check:linked_files (first_time)  ** Execute deploy:check:linked_files  ** Invoke deploy:set_previous_revision (first_time)  ** Execute deploy:set_previous_revision  ** Invoke deploy:started (first_time)  ** Execute deploy:started  ** Invoke deploy:updating (first_time)  ** Invoke deploy:new_release_path (first_time)  ** Execute deploy:new_release_path  ** Execute deploy:updating  ** Invoke git:create_release (first_time)  ** Invoke git:update (first_time)  ** Invoke git:clone (first_time)  ** Invoke git:wrapper   ** Execute git:clone  INFO The repository mirror is at /www/apps/foodsoft-production/repo  ** Execute git:update  INFO [2a9825e1] Running /usr/bin/env git remote update as deploy@biomio-giessen.de  INFO [2a9825e1] Finished in 0.403 seconds with exit status 0 (successful).  ** Execute git:create_release  INFO [f8c5ea11] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/releases/20160322103403 as deploy@biomio-giessen.de  INFO [f8c5ea11] Finished in 0.005 seconds with exit status 0 (successful).  INFO [2f0b416d] Running /usr/bin/env git archive master | tar -x -f - -C /www/apps/foodsoft-production/releases/20160322103403 as deploy@biomio-giessen.de  INFO [2f0b416d] Finished in 0.190 seconds with exit status 0 (successful).  ** Invoke deploy:set_current_revision (first_time)  ** Execute deploy:set_current_revision  ** Invoke git:set_current_revision (first_time)  ** Execute git:set_current_revision  INFO [dbe94281] Running /usr/bin/env echo "42eb6c8" >> REVISION as deploy@biomio-giessen.de  INFO [dbe94281] Finished in 0.006 seconds with exit status 0 (successful).  ** Invoke deploy:symlink:shared (first_time)  ** Execute deploy:symlink:shared  ** Invoke deploy:symlink:linked_files (first_time)  ** Execute deploy:symlink:linked_files  INFO [b4c135fd] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/releases/20160322103403/config /www/apps/foodsoft-production/releases/20160322103403/config /www/apps/foodsoft-production/releases/20160322103403/config/initializers /www/apps/foodsoft-production/releases/20160322103403/config/initializers as deploy@biomio-giessen.de  INFO [b4c135fd] Finished in 0.005 seconds with exit status 0 (successful).  INFO [5d161cf6] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/config/database.yml /www/apps/foodsoft-production/releases/20160322103403/config/database.yml as deploy@biomio-giessen.de  INFO [5d161cf6] Finished in 0.004 seconds with exit status 0 (successful).  INFO [0982872f] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/config/app_config.yml /www/apps/foodsoft-production/releases/20160322103403/config/app_config.yml as deploy@biomio-giessen.de  INFO [0982872f] Finished in 0.004 seconds with exit status 0 (successful).  INFO [ce0a752c] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/config/initializers/secret_token.rb /www/apps/foodsoft-production/releases/20160322103403/config/initializers/secret_token.rb as deploy@biomio-giessen.de  INFO [ce0a752c] Finished in 0.008 seconds with exit status 0 (successful).  INFO [1ba649fb] Running /usr/bin/env rm /www/apps/foodsoft-production/releases/20160322103403/config/initializers/session_store.rb as deploy@biomio-giessen.de  INFO [1ba649fb] Finished in 0.004 seconds with exit status 0 (successful).  INFO [d1dd71ed] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/config/initializers/session_store.rb /www/apps/foodsoft-production/releases/20160322103403/config/initializers/session_store.rb as deploy@biomio-giessen.de  INFO [d1dd71ed] Finished in 0.004 seconds with exit status 0 (successful).  ** Invoke deploy:symlink:linked_dirs (first_time)  ** Execute deploy:symlink:linked_dirs  INFO [d5cdfe7b] Running /usr/bin/env mkdir -p /www/apps/foodsoft-production/releases/20160322103403 /www/apps/foodsoft-production/releases/20160322103403 /www/apps/foodsoft-production/releases/20160322103403/tmp /www/apps/foodsoft-production/releases/20160322103403/tmp /www/apps/foodsoft-production/releases/20160322103403/tmp /www/apps/foodsoft-production/releases/20160322103403/vendor /www/apps/foodsoft-production/releases/20160322103403/public /www/apps/foodsoft-production/releases/20160322103403/public as deploy@biomio-giessen.de  INFO [d5cdfe7b] Finished in 0.005 seconds with exit status 0 (successful).  INFO [4b677f5f] Running /usr/bin/env rm -rf /www/apps/foodsoft-production/releases/20160322103403/bin as deploy@biomio-giessen.de  INFO [4b677f5f] Finished in 0.008 seconds with exit status 0 (successful).  INFO [13892133] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/bin /www/apps/foodsoft-production/releases/20160322103403/bin as deploy@biomio-giessen.de  INFO [13892133] Finished in 0.004 seconds with exit status 0 (successful).  INFO [8a1fa6d1] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/log /www/apps/foodsoft-production/releases/20160322103403/log as deploy@biomio-giessen.de  INFO [8a1fa6d1] Finished in 0.005 seconds with exit status 0 (successful).  INFO [2ed57f9f] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/tmp/pids /www/apps/foodsoft-production/releases/20160322103403/tmp/pids as deploy@biomio-giessen.de  INFO [2ed57f9f] Finished in 0.014 seconds with exit status 0 (successful).  INFO [371f2387] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/tmp/cache /www/apps/foodsoft-production/releases/20160322103403/tmp/cache as deploy@biomio-giessen.de  INFO [371f2387] Finished in 0.004 seconds with exit status 0 (successful).  INFO [c544c79f] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/tmp/sockets /www/apps/foodsoft-production/releases/20160322103403/tmp/sockets as deploy@biomio-giessen.de  INFO [c544c79f] Finished in 0.058 seconds with exit status 0 (successful).  INFO [f8ed544f] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/vendor/bundle /www/apps/foodsoft-production/releases/20160322103403/vendor/bundle as deploy@biomio-giessen.de  INFO [f8ed544f] Finished in 0.010 seconds with exit status 0 (successful).  INFO [5195fd5c] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/public/system /www/apps/foodsoft-production/releases/20160322103403/public/system as deploy@biomio-giessen.de  INFO [5195fd5c] Finished in 0.004 seconds with exit status 0 (successful).  INFO [4973bc2e] Running /usr/bin/env ln -s /www/apps/foodsoft-production/shared/public/assets /www/apps/foodsoft-production/releases/20160322103403/public/assets as deploy@biomio-giessen.de  INFO [4973bc2e] Finished in 0.004 seconds with exit status 0 (successful).  ** Invoke deploy:updated (first_time)  ** Execute deploy:updated  ** Invoke deploy:compile_assets (first_time)  ** Invoke deploy:set_rails_env   ** Execute deploy:compile_assets  ** Invoke deploy:assets:precompile (first_time)  ** Execute deploy:assets:precompile  INFO [fbcd3711] Running /usr/local/rvm/bin/rvm default do rake assets:precompile as deploy@biomio-giessen.de  cap aborted!  SSHKit::Runner::ExecuteError: Exception while executing as deploy@biomio-giessen.de: rake exit status: 1  rake stdout: Nothing written  rake stderr: rake aborted!  Bundler::GemNotFound: Could not find activesupport-4.2.5.2 in any of the sources  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:94:in `block in materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `map!'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:137:in `specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:182:in `specs_for'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:171:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/environment.rb:18:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:13:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/boot.rb:6:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/application.rb:1:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/Rakefile:5:in `<top (required)>'  (See full trace by running task with --trace)  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'  SSHKit::Command::Failed: rake exit status: 1  rake stdout: Nothing written  rake stderr: rake aborted!  Bundler::GemNotFound: Could not find activesupport-4.2.5.2 in any of the sources  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:94:in `block in materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `map!'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:137:in `specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:182:in `specs_for'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:171:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/environment.rb:18:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:13:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/boot.rb:6:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/application.rb:1:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/Rakefile:5:in `<top (required)>'  (See full trace by running task with --trace)  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/command.rb:100:in `exit_status='  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/netssh.rb:127:in `execute_command'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `block in create_command_and_execute'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `tap'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `create_command_and_execute'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:69:in `execute'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/capistrano-rails-1.1.6/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:88:in `with'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/capistrano-rails-1.1.6/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:80:in `within'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/capistrano-rails-1.1.6/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:29:in `run'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/sshkit-1.9.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'  Tasks: TOP => deploy:assets:precompile  The deploy has failed with an error: Exception while executing as deploy@biomio-giessen.de: rake exit status: 1  rake stdout: Nothing written  rake stderr: rake aborted!  Bundler::GemNotFound: Could not find activesupport-4.2.5.2 in any of the sources  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:94:in `block in materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `map!'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `materialize'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:137:in `specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:182:in `specs_for'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/definition.rb:171:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/environment.rb:18:in `requested_specs'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:13:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'  /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/boot.rb:6:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/config/application.rb:1:in `<top (required)>'  /www/apps/foodsoft-production/releases/20160322103403/Rakefile:5:in `<top (required)>'  (See full trace by running task with --trace)  ** Invoke deploy:failed (first_time)  ** Execute deploy:failed  

Here my Capfile

# Load DSL and Setup Up Stages  require 'capistrano/setup'    # Includes default deployment tasks  require 'capistrano/deploy'    # Includes tasks from other gems included in your Gemfile  #  # For documentation on these, see for example:  #  #   https://github.com/capistrano/rvm  #   https://github.com/capistrano/rbenv  #   https://github.com/capistrano/chruby  #   https://github.com/capistrano/bundler  #   https://github.com/capistrano/rails  #   require 'capistrano/rvm'  # require 'capistrano/rbenv'  # require 'capistrano/chruby'  # require 'capistrano/bundler'  require 'capistrano/rails/assets'  require 'capistrano/rails/migrations'    # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.  Dir.glob('lib/capistrano/tasks/*.{cap,rake}').each { |r| import r }  

and my Gemfile

# A sample Gemfile  source "https://rubygems.org"    gem "rails", '~> 4.2'  gem 'sass-rails'  gem 'coffee-rails'  gem 'less-rails'  gem 'uglifier', '>= 1.0.3'  # See https://github.com/sstephenson/execjs#readme for more supported runtimes  gem 'therubyracer', platforms: :ruby      gem 'jquery-rails'  gem 'select2-rails'  gem 'rails_tokeninput'  gem 'bootstrap-datepicker-rails'  gem 'date_time_attribute'  gem 'rails-assets-listjs', '0.2.0.beta.4' # remember to maintain list.*.js plugins and template engines on update  gem 'i18n-js', '~> 3.0.0.rc8'  gem 'rails-i18n'    gem 'mysql2'  gem 'prawn'  gem 'prawn-table'  gem 'haml-rails'  gem 'kaminari'  gem 'simple_form'  gem 'inherited_resources'  gem 'localize_input', git: "git://github.com/bennibu/localize_input.git"  gem 'daemons'  gem 'twitter-bootstrap-rails', '~> 2.2.8'  gem 'simple-navigation', '~> 3.14.0' # 3.x for simple_navigation_bootstrap  gem 'simple-navigation-bootstrap'  gem 'ransack'  gem 'acts_as_tree'  gem 'rails-settings-cached'  gem 'resque'  gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb  gem 'protected_attributes'  gem 'ruby-units'  gem 'attribute_normalizer'  gem 'ice_cube', github: 'wvengen/ice_cube', branch: 'issues/50-from_ical-rebased' # fork until merged  gem 'recurring_select'  gem 'roo', '~> 1.13.2'  gem 'spreadsheet'    # we use the git version of acts_as_versioned, and need to include it in this Gemfile  gem 'acts_as_versioned', github: 'technoweenie/acts_as_versioned'  gem 'foodsoft_wiki', path: 'plugins/wiki'  gem 'foodsoft_messages', path: 'plugins/messages'    # plugins not enabled by default  #gem 'foodsoft_uservoice', path: 'plugins/uservoice'      group :production do    gem 'exception_notification'  end    group :development do    gem 'sqlite3'    gem 'mailcatcher'    gem 'web-console', '~> 2.0'      # allow to use `debugger` https://github.com/conradirwin/pry-rescue    gem 'pry-rescue'    gem 'pry-stack_explorer'      # Better error output    gem 'better_errors'    gem 'binding_of_caller'    # gem "rails-i18n-debug"    # chrome debugging extension https://github.com/dejan/rails_panel    gem 'meta_request'      # Get infos when not using proper eager loading    gem 'bullet'      # Hide assets requests in log    gem 'quiet_assets'      # Deploy with Capistrano    gem 'capistrano', '~> 3.4.0', require: false    gem 'capistrano-rvm', require: false    gem 'capistrano-bundler', '>= 1.1.0', require: false    gem 'capistrano-rails', require: false    # Avoid having content-length warnings    gem 'thin'  end    group :development, :test do    gem 'ruby-prof', require: false  end    group :test do    gem 'rspec-rails'    gem 'factory_girl_rails'    gem 'faker'    gem 'capybara'    # webkit and poltergeist don't seem to work yet    gem 'selenium-webdriver'    gem 'database_cleaner'    gem 'connection_pool'    # need to include rspec components before i18n-spec or rake fails in test environment    gem 'rspec-core', '~> 3.2'    gem 'rspec-rerun'    gem 'rspec-legacy_formatters'    gem 'i18n-spec'    # code coverage    gem 'simplecov', require: false    gem 'coveralls', require: false  end  

and finally my deploy.rb

#  # Capistrano 3 deployment configuration  #  #   http://www.capistranorb.com/  #   https://semaphoreapp.com/blog/2013/11/26/capistrano-3-upgrade-guide.html    # defaults that can be updated from the environment  set :branch,              ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"    # you probably want to change these  set :application,         'foodsoft'            # application name (whatever you like)  set :domain,              'biomio-giessen.de' # host  set :user,                'deploy'              # ssh deploy user  set :keep_releases,       10  set :repo_url,            'git://github.com/foodcoops/foodsoft.git'  set :deploy_to,            "/www/apps/#{fetch :application}-#{fetch :stage}"    # more settings which are probably ok  set :log_level,           :info  set :linked_files,        %w{config/database.yml config/app_config.yml config/initializers/secret_token.rb config/initializers/session_store.rb}  set :linked_dirs,         %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}    # assuming one server for everything, with one user for deploy and one for resque  server fetch(:domain), user: fetch(:user), roles: [:web, :app, :resque, :db]    # if you use RVM, uncomment the line in Capfile, and optionally uncomment rvm settings  # set :rvm_ruby_string,     :local    # task hooks  namespace :deploy do      desc 'Restart application'    task :restart do      on roles(:app), in: :sequence, wait: 5 do        # tell mod_passenger to reload the application        execute :touch, release_path.join('tmp/restart.txt')      end    end      after :restart, 'resque:restart'      after :finishing, 'deploy:cleanup'      # see lib/capistrano/tasks/plugins.cap    #before 'bundler:install', 'enable_plugins:auto'    end  

I already tried to remove all gems and gemsets and to bundle to the system with bundle install --system. When I run gem install activesupport -v "4.2.5.2" bundler will find this gem but not the next one. Do I have to type 175 times gem install requiered_gem or is there a possibility to give bundler a correct path?

Thank you for your help, Maxi

uninitialized constant Model::AlgoliaSearch

Posted: 22 Mar 2016 04:07 AM PDT

I have an issue including Algolia module in my rails app I have included gem "algoliasearch-rails", ran bundle install and added in config/initializers an algoliasearch.rb file with api id and key

#model.rb    include AlgoliaSearch    algoliasearch do   attribute :name, :description, :content, :is_public => true  end  

How to fix this bundle install issue?

Posted: 22 Mar 2016 06:24 AM PDT

I am performing bundle install. There I am getting

An error occurred while installing amq-protocol (2.0.1), and Bundler cannot continue. Now when I install this amq-protocol version then I get that my ruby version in not compatible with this version of amq.Then I installed am1-protocol (1.9.2 ,compatible with my ruby).Again I am performing bundle install ,then getting same problem.In which file I can get setting for amq version or any other solution. Thanks

Moved a Rails app to EC2 and now my file uploads get a Encoding::UndefinedConversionError ("\xC3" from ASCII-8BIT to UTF-8) error

Posted: 22 Mar 2016 05:04 AM PDT

I've got a Rails app that has been live for over a year with no issues, running on a custom Ubuntu/Nginx/Puma setup.

Because of various issues with the hosting company, I moved the app over to EC2 this weekend - using ElasticBeanstalk on their Nginx/Puma/Ruby2.2 stack.

Everything is working fine - apart from file uploads.

The app itself uses the Paperclip gem for handling attachments - the actual files are only held momentarily in Paperclip, before being uploaded to a file-server controlled by my client (the very first version used S3 for storage, but now it uploads, attaches the "Job-Sheet" to the Job and then immediately uploads the "Job-Sheet" to the file-server).

As I say, this was all working fine on my old server. But now, on EC2, I'm getting a Encoding::UndefinedConversionError ("\xC3" from ASCII-8BIT to UTF-8) error.

The job sheet itself can be an Excel file or a CSV. It is defined as follows:

class Job < ActiveRecord::Base    ...    has_attached_file :job_sheet    validates_attachment_file_name :job_sheet, matches: [/csv\Z/, /xls\Z/, /xlsx\Z/]    validates_attachment_presence :job_sheet    ...  end  

The controller looks like this:

class JobsController < ApplicationController    ...    def create      @job = services['creates_job'].create_job job_params, session: current_session      redirect_to jobs_path    rescue ActiveRecord::RecordInvalid      ...    end    ...  end  

The jobs_params does the StrongParams thing of permitting the parameters as required.

And the CreatesJob service object looks like:

def create_job params, session: nil    ...    job = services['jobs'].create! params.merge(code: code)    ...  end  

So apart from the fact that the actual logic is in a separate "CreatesJob" class, there's nothing unusual going on - pretty much a standard Rails/Paperclip upload situation.

However, some uploads are failing, with the following in the production log:

I, [2016-03-22T10:12:58.701172 #23116]  INFO -- : Started POST "/jobs" for 80.0.249.70 at 2016-03-22 10:12:58 +0000  F, [2016-03-22T10:12:58.706190 #23116] FATAL -- : Encoding::UndefinedConversionError ("\xC3" from ASCII-8BIT to UTF-8):    actionpack (4.2.0) lib/action_dispatch/http/upload.rb:31:in `encode'    actionpack (4.2.0) lib/action_dispatch/http/upload.rb:31:in `initialize'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:51:in `new'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:51:in `normalize_encode_params'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:57:in `block in normalize_encode_params'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each_with_object'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `normalize_encode_params'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:57:in `block in normalize_encode_params'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each_with_object'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `normalize_encode_params'    actionpack (4.2.0) lib/action_dispatch/http/request.rb:308:in `POST'    actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:14:in `parameters'    actionpack (4.2.0) lib/action_dispatch/http/filter_parameters.rb:37:in `filtered_parameters'    actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:22:in `process_action'    actionpack (4.2.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'    activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'    actionpack (4.2.0) lib/abstract_controller/base.rb:137:in `process'    actionview (4.2.0) lib/action_view/rendering.rb:30:in `process'    actionpack (4.2.0) lib/action_controller/metal.rb:195:in `dispatch'    actionpack (4.2.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'    actionpack (4.2.0) lib/action_controller/metal.rb:236:in `block in action'    actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `call'    actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'    actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:42:in `serve'    actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'    actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `each'    actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'    actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/rack/browser_monitoring.rb:23:in `traced_call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/etag.rb:24:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/conditionalget.rb:38:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/head.rb:13:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context'    rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'    activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `call'    activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'    activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'    activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'    actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'    railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'    activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'    activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'    activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'    railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/runtime.rb:18:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    rack (1.6.1) lib/rack/sendfile.rb:113:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    railties (4.2.0) lib/rails/engine.rb:518:in `call'    railties (4.2.0) lib/rails/application.rb:164:in `call'    newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'    puma (2.11.0) lib/puma/configuration.rb:82:in `call'    puma (2.11.0) lib/puma/server.rb:507:in `handle_request'    puma (2.11.0) lib/puma/server.rb:375:in `process_client'    puma (2.11.0) lib/puma/server.rb:262:in `block in run'    puma (2.11.0) lib/puma/thread_pool.rb:104:in `call'    puma (2.11.0) lib/puma/thread_pool.rb:104:in `block in spawn_thread'  

The other answers related to this error all seem to be about forcing the encoding of the file. But the issue here seems to be 1) sometimes it's a binary (xls) and sometimes text (csv) so I can't go around mangling it and 2) the exception is in ActionDispatch; so looks like it's happening before I get to see the upload.

Any ideas what's going on and what I can do to fix it?

UPDATE: I can now reproduce the issue consistently. If I upload an XLSX file with an English filename, the upload works OK, if it's an XLSX file with Spanish accented in the filename, the upload fails as shown above.

The line in question is @original_filename.encode!(Encoding::UTF_8) in action_dispatch/http/upload.rb - however, the filename should be valid unicode, but it's obviously getting mangled in transit somewhere.

Access custom select field in Kaminari

Posted: 22 Mar 2016 04:58 AM PDT

I have a model that is paginated, and in some cases I want to add an extra column to the query and retrieve that same column in my paginated results. For example:

users = User.select('users.value is NULL as val').page(2)  

If I do users['val'] then it gives me nothing. But if I remove the pagination users = User.select('users.value is NULL as val') then users['val'] will give me what I want. How can I do this with Kaminari?

Where to store nationalities array in Rails app?

Posted: 22 Mar 2016 03:39 AM PDT

I have a user object that has a nationality column which is a string. A user upon sign-up is able to pick their nationality via a dropdown. I'm wondering where should I store this NATIONALITIES constant, seeing that i'll be a huge array of strings.

Create actions off of collection

Posted: 22 Mar 2016 03:43 AM PDT

I want to create some actions dynamically, something like the below.

But as the code is not in a method I get the following error: "undefined local variable or method"

Is this at all possible, and if so - how?

class Post < ActiveRecord::Base    CATEGORIES = [:music,:movies,:art,:jokes,:friends,:whatever].freeze  end    class PostsController < ApplicationController    Post::CATEGORIES.each do |category|      eval <<-INDEX_LIKE_ACTIONS        def #{category}          @posts = Post.where( category: '#{category}' )          render :index        end      INDEX_LIKE_ACTIONS    end  end    resources :posts do     collection do       Post::CATEGORIES.each {|category| get category.to_s}     end  end  

ActiveAdmin insert action page from other resource

Posted: 22 Mar 2016 03:23 AM PDT

I am currently customizing the views of ActiveAdmin and I would like to know if it is possible to partial render in a panel from a resource A show page the index page of a resource B for instance.

With more details, let's say I have a User resource which has_many Posts, on the show page of a user I am doing statistics and I added lots of panels. I would also like to show the "edit" or "index" action of the posts of my user for instance, or more complicated actions.

In my User show controller, I made my query to retrieve the Posts of the User with the joins I needed, but I don't know how to show a beautiful table and filter area as in the index page of the Posts...

Is there anything to do something like:

ActiveAdmin.register User do    show do          panel "posts" do        my_object = my_query_using_active_record        render :partial => "index", :locals => { :posts => my_object }      end    end  end  

But I would like it to render the index layout of ActiveAdmin instead of looking for my own _index.html file. I'd like to point out that it is not exactly the same thing as the index layout for the Post resource since I have a complicated query with many joins and would like to show thus more than just posts.

Moreover, I'd also like to do this kind of thing but with the edit layout, which might be complicated since it would create a form and the show action of the user.

I am open to any remark If I am doing things wrong and missed something in the ActiveAdmin design.

No comments:

Post a Comment