The copy module copies a file on the local box to remote locations. Use the fetch module to copy files from remote locations to the local box. If you need variable interpolation in copied files, use the template module.
should use the command module to do a cp in this case.
- name: Move foo to bar
command: creates="path/to/bar" cp /path/to/foo /path/to/bar
From version 2.0 in file plugin you can use remote_src parameter. If True it will go to the remote/target machine for the src.
- name: Copy files from foo to bar
copy: remote_src=True src=/path/to/foo dest=/path/to/bar
def card_params
params.require(:card).permit(:original_text, :translated_text, :review_date, :image, :deck_id, deck: [:title]).deep_merge(deck: {user_id: current_user.id})
end
def self.create_with_deck(params)
deck_params = params.delete(:deck)
if params[:deck_id].blank?
deck = Deck.create(deck_params)
params.deep_merge!(deck_id: deck[:id])
end
create(params)
end
class Task < ActiveRecord::Base
include AASM
aasm :column => 'status' do
state :in_work, :initial => true
state :completed
event :run do
transitions :from => :completed, :to => :in_work
end
event :complete do
transitions :from => :in_work, :to => :completed
end
end
class TasksController < ApplicationController
before_action :find_task, only: [:show, :edit, :update, :destroy, :run, :complete]
def run
@task.run!
redirect_to tasks_path
end
def complete
@task.complete!
redirect_to tasks_path
end
<% @tasks.each do |task| %>
<% if task.in_work? %>
<%= link_to 'Complete', complete_task_path(task), method: :put %>
<% else %>
<%= link_to 'Run', run_task_path(task), method: :put %>
<% end %>
<% end %>
resources :tasks do
member do
put :run
put :complete
end
end