Home>
We are implementing the purchase function. I'm in trouble because I can't find the error.
View<% = form_with model: (@userdonation, item_purchases_path, id:'charge-form', class:'transaction-form-wrap', local: true) do | f |%>
<% = render partial:'shared/error_messages', locals: {model: f.object}%>
<% #Enter card information%>
Credit card information input
<label>Card information</label>
<span>Required</span>
<% = f.text_field'hoge', class: "input-default", id: "card-number", placeholder: "card number (half-width alphanumeric characters)", maxlength: "16"%>
<% = image_tag'card-visa.gif', class:'card-logo'%>
<% = image_tag'card-mastercard.gif', class:'card-logo'%>
<% = image_tag'card-jcb.gif', class:'card-logo'%>
<% = image_tag'card-amex.gif', class:'card-logo'%>
<label>Expiration date</label>
<span>Required</span>
<% = f.text_area'hoge', class: "input-expiration-date", id: "card-exp-month", placeholder: "Example) 3"%>
<p>Month</p>
<% = f.text_area'hoge', class: "input-expiration-date", id: "card-exp-year", placeholder: "Example) 23"%>
<p>year</p>
<label>Security code</label>
<span>Required</span>
<% = f.text_field "hoge", class: "input-default", id: "card-cvc", placeholder: "4 or 3 digit number on the back of the card", maxlength: "4"%>
<% #/Enter card information%>
Rails.application.routes.draw do
devise_for: users
root to: "items # index"
resources: items, only: [: new,: create,: show,: edit,: update,: destroy] do
resources: purchases, only: [: index,: new,: create]
end
end
class UserDonation
include ActiveModel :: Model
attr_accessor: post_code,: city,: block_number,: building_name,: phone_number,: prefecture_id,: purchases_id,: item_id,: user_id
with_options presence: true do
validates: city,: block_number,: phone_number,: prefecture_id
validates: post_code, format: {with:/\ A [0-9] {3}-[0-9] {4} \ z /, message: "is invalid. Include hyphen (-)"}
validates: region_id, numericality: {other_than: 0, message: "can't be blank"}
end
def save
Address.create (post_code: post_code, city: city, block_number: block_number, building_name: building_name, phone_number: phone_number, prefecture_id: prefecture_id, purchases_id: purchases_id)
Purchase.create (item_id: item_id, user_id: user_id)
end
end
class PurchasesController
class Purchase
class Address
-
Answer # 1
Related articles
- ruby - syntax error, unexpected cannot be solved [rails]
- ruby - the error in rails g migration cannot be resolved
- ruby on rails - the image cannot be saved in s3 and cannot be displayed in the view aws :: sigv4 :: errors :: missingcredentials
- ruby on rails - you cannot change the keychain after downloading the pem file when creating an ec2 instance the matter that come
- ruby - [i'm having trouble with an error] cannot add foreign key constraint
- ruby on rails - uncaught reference error: $is not defined cannot be resolved
- ruby on rails - about matters that cannot be migrated
- ruby on rails - rspec validation error
- solution for ruby on rails routes error
- ruby - rails cannot be started in the production environment when building an ec2 environment
- ruby on rails - rails routing error
- ruby on rails - cannot start unicorn cannot load `railsconfigactive_storageservice`
- ruby on rails - i cannot save a comment on the comment posting page
- ruby on rails 6 - [error] uninitialized constant user (call'userconnection' to establish a connection) :: image
- ruby on rails - rspec test changed by -1, but was changed by 0 error
- ruby - [rails] about the error that occurs when deleting likes (routing error)
- ruby - the information entered in the form is not an error but cannot be saved
- ruby on rails - i want to resolve rails name error
- ruby on rails - unknown action error when trying to post a comment
Trends
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
This part, model is out of parentheses
How about changing it as follows?