Closed sveredyuk closed 3 years ago
Hi, Volodya! I'll try to fix this within the week.
@sveredyuk I couldn't reproduce the bug :( https://github.com/bibendi/activerecord-postgres_enum/pull/42
@bibendi Very strange. Just used github version and it's reproducing.
Ok, I will try to debug it myself and let you know.
@bibendi Are you sure used Ruby 3.0? I think it's because of options hash vs named attributes in ruby 3.0 issue.
I changed lib/active_record/postgres_enum/extenstions.rb ColumnMethods#enum method
def enum(name, options = {})
column(name, options.delete(:enum_name), index: options.delete(:index), **options.except(:enum_name))
end
And it works fine. Can I open the PR?
Oh, shoot, Ruby 3 is very new for me 😄 Sure, feel free to fix the issue!
Please #43
Thank you for explaination the bug and your PR! But it takes a little bit more effort to make it works. I've fixed it at #42 and released the gem. Please, try v1.6.0!
@sveredyuk and anyone that has answers i get the similar error on my project when I click the "edit" button after creating a dealership and Cars. It is a ruby based app. https://github.com/EPIC448/car_inventory/tree/main/car_inventory It is open project on github thus it is easy to clone and run through, none of my developer guys could find an answer to this.
What I am getting my website page.
ArgumentError in InventoriesController#update
wrong number of arguments (given 1, expected 2)
def update
if @inventory.update_attribute(inventory_params)
redirect_to(@inventory.dealership(notice: 'Inventory was successfully updated.'))
else
render action: 'edit'
end
car_inventory/controllers/inventories_controller.rb
# POST dealerships/1/inventories
def create
@inventory = @dealership.inventories.build(inventory_params)
if @inventory.save
redirect_to(@inventory.dealership, notice: 'Inventory was successfully created.')
else
render action: 'new'
end
end
# PUT dealerships/1/inventories/1
def update
if @inventory.update_attribute(inventory_params)
redirect_to(@inventory.dealership(notice: 'Inventory was successfully updated.'))
else
render action: 'edit'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_dealership
@dealership = current_user.dealerships.find(params[:dealership_id])
end
def set_inventory
@inventory = @dealership.inventories.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def inventory_params
params.require(:inventory).permit(:carmodel, :price, :status, :dealership_id)
end
thank you in advance. Please if I missed an important information to aid in this process, let me know. This is my first attempt at writing on github :)
Describe the bug Hi, folks. Caught strange bug Ruby 3.0 + Rails 6.1
after rails db:migrate I got:
I assume this can be rails 6.1 issue, because in pry I got:
Can I somehow workaround this?