I was going to create a link to a controller's action update_heimdall here is the code:
app/controller/admins_controller:
def heimdall
@headline = "Heimdall"
@users = User.where(deleted_at: nil)
authorize @users
@focusUser = params['users'].blank? ? current_user : User.find(params['users'])
heim = Heimdall.new
@cards = heim.get_cards(@focusUser.trello_id, @focusUser.trello_access_token, @focusUser.trello_secret_token)
end
def update_heimdall
@user = params['users'].blank? ? current_user : User.find(params['users'])
authorize @user
heim = Heimdall.new
heim.update_cards(@user.trello_id, @user.trello_access_token, @user.trello_secret_token)
end
app/views/admins/heimdall.html.rb:
<%= link_to "Odśwież", update_heimdall(), class: "btn btn-warning" %>
I am enclosing as well listing from rails routes command:
heimdall GET /heimdall(.:format) admins#heimdall
update_heimdall GET /heimdall/update_heimdall/:id(.:format) admins#update_heimdall
Unfortunately this code causes the following error:
undefined method `update_heimdall'.