This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Map / Мапа / Словарь | |
| --------------------- | |
| // Описание мапы (так ты ее описала, но еще не создала, память под нее не выделена, использовать еще нельзя) | |
| var m map[string]int | |
| // Делаешь мапу - теперь под нее выделяется память и в нее уже можно записывать занчения | |
| m = make(map[string]int) | |
| // Задаешь значение по ключу |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FinalResult | |
| def results(filename) | |
| @filename = filename | |
| prepare | |
| output | |
| end | |
| def prepare | |
| CSV.foreach(file) do |row| | |
| records << row_record(row) if row.length == 16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| / app/views/rails_workflow/operations/_some_event_partial.html.slim | |
| ruby: | |
| # I know it's bad code but doing it this way just to focus | |
| # on post topic | |
| user = User.find(context.data["user"][:id]) | |
| table.table.table-striped.table-hover | |
| tbody | |
| tr | |
| td User |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RailsWorkflow::EventManager.create_event(‘some_event’, { user_id: 14 }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeEvent < RailsWorkflow::EventOperation | |
| # We getting here event context - which we can use to match | |
| # this operation to a given event | |
| def match(event_context) | |
| event_context[:user_id] == user.id | |
| end | |
| private | |
| def user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RailsWorkflow::EventManager.create_event('some_event', { event_context: 'bla-bla-bla' }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OperationsController < ApplicationController | |
| ... | |
| skip_before_action :navigate_to_current_operation | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| ... | |
| before_action :navigate_to_current_operation | |
| def navigate_to_current_operation | |
| return unless current_operation | |
| redirect_to current_operation_path | |
| end | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| ... | |
| before_action :navigate_to_current_operation | |
| def navigate_to_current_operation | |
| return unless current_operation | |
| redirect_to send(current_operation.data[:url_path], *current_operation.data[:url_params]) | |
| end | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OperationsController < ApplicationController | |
| before_action do | |
| @skip_current_operation_button = true | |
| end | |
| ... | |
| end |
NewerOlder