After the
I built a webapp to buy coffee to test.
I used to create used rail scam to make your item vendor:
Railway generated scaffolding expresso_count: integer cuppucino_count: integer
Some other variables are not included above, but all of a kind integer
When a user buys a coffee, a variable in the seller such as: cuppucino_count is updated. This vendor uses this custom method in the controller which uses .update
def buy_pass @vendor = Vendor.find ([: id] parameter) # Checks vendor if @vendor.vendor_pass Thank you for your purchase of .to_s = passed = Vendor_params [: vendor_pass] flash [: success] = "1x # {params [: type]}". Coffee type #updates if parameter [: type] == 'espresso' coffee_count = @ vendor.expresso_count coffee_count = coffee_count +1 @ vendor.update (expresso_count: coffee_count) end redirect_to buy_thanks_path any other flash [: error] = "incorrect pass Make sure you enter the correct pass. " Purchase End
End
Who is actioned with this link
& Lt; Span style = "font-size: 300%;" Class = "fa fa-coffee" & gt; & Lt; / Span & gt; Americano <% end%> & Lt; / P & gt;
Heroku, for sellers, see index.html, order that vendor changes appear whenever a vendor becomes updated using either edit.html view or .update method is. I.e
ie: if
seller1, vendor2, vendor 3
this
Code> Seller 2, Seller 3, Seller 1
If seller 1 was updated
However this sequence will not change in my local installation.
What is happening with any idea? Here is a link to my GIT repo:
The question is: Code> @ vendors variable is being set to the index
method; This is what will determine what is being displayed in the index page.
If you skipped the code from Scaffold, then this would look like the following:
df index = vendors = wander.all
Runs the query on the table
from the vendors.
Note that the query does not contain any order segment. From:
If the section is specified by the order, the returned rows are sorted in the specified order. If the order is not ordered, then the rows are returned in whatever order they get the fastest system to produce. (See order according to the rule given below.)
This indicates why the order of the order is different at local level and at Horoku.
To show results in a particular order, specify the order segment as follows:
DIF index @ vendors = seller. Order (id) end
No comments:
Post a Comment