Skip to content

Commit

Permalink
set app first
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Jun 14, 2024
1 parent 4644c2f commit ce3a251
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/sync/items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module Sync
class ItemsController < BaseController
skip_forgery_protection only: [:create]
before_action :set_app

def index
@items = Item.none.page(params[:page])
end

def create
raw_params.each do |record_name, columns|
record = Record.find_or_initialize_by(key: record_name)
record = @app.records.find_or_initialize_by(key: record_name)
columns.each do |column|
record.forms.find_or_initialize_by(external_column_name: column)
end
Expand All @@ -18,5 +19,10 @@ def create
head :ok
end

private
def set_app
@app = App.first
end

end
end

0 comments on commit ce3a251

Please sign in to comment.