Questions tagged [after-create]
37 questions
0
votes
1 answer
Rails: Associating an Object After Creation
I am trying to create a site that will show step by step instructions. A user will view a question and select answer. The answer view is shown below:
<%= notice %>
Post: <%= @question.post %>
<%=…
jstein
- 633
- 1
- 8
- 14
0
votes
1 answer
Using after_create to update a cart's order_id
First, I have a cart stored in a session. The carts contain line items(products). The checkout button leads to a Order.new form with the cart_id passed to the new order(cart has_one order, order belongs_to cart).
Hopefully so far so good.
The cart…

Peege151
- 1,562
- 2
- 21
- 45
0
votes
3 answers
Follow BETA Inviter on Sign Up
I have created a BETA Invitation system by following this tutorial. http://railscasts.com/episodes/124-beta-invitations. Users can also follow one another in my Rails app.
How can I have the Invitee follow the person who Invited him on sign…

Serge Pedroza
- 2,160
- 3
- 28
- 41
0
votes
1 answer
rails3 callback for nested record creation
On creation of a record, I am attempting, on creation of parent class Quote, to set default values for related class Optionvolume
class Optionvolume < ActiveRecord::Base
belongs_to :option
belongs_to :quote
class Option < ActiveRecord::Base
…

Jerome
- 5,583
- 3
- 33
- 76
0
votes
0 answers
after_create for setting dummy password_digest in case of oauth user with has_secure_password
I'm using has_secure_password with a User model. I'd like to set the password_digest string to a dummy value if the user signed up via oauth. Currently, I am only doing facebook and saving the user with facebook_id. I'd like to add the following…

timpone
- 19,235
- 36
- 121
- 211
0
votes
2 answers
after_create destroy a record
I have two tables bookings and rentals. A user books a car to rent and an admin approves the rental.
As the admin approves the rental. The booking is no longer needed. How can i delete the booking record at the same time as creating the rental…

Messyeater
- 117
- 1
- 11
-2
votes
2 answers
Rails Controller behave weird with 'after_create' method. - 'undefined method `errors' for nil:NilClass'
I am a newbie to rails. Please excuse this.
I am trying to implement 'after_create' into my controller, in order to make data into different table in DB.
after_create :create_order_confirm
It will call this.
def create_order_confirm
…

Jin Lim
- 1,759
- 20
- 24