Questions tagged [after-create]

37 questions
1
vote
2 answers

Rails Load Data into Application every time a New User is Created

I am trying to figure out the "right" way to do this. In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those…
looloobs
  • 761
  • 2
  • 11
  • 24
1
vote
1 answer

how to send instant variable from controller to methods after create in rails?

how to send instant variable from controller to methods after create in rails? if i have controller like this : class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_url def set_url @url = if…
3lviend
  • 243
  • 5
  • 13
0
votes
2 answers

rails: Accessing member variables in after_create

I am building a survey app where, based on ratings I need certain things to happen. Basically, if a survey is submitted with a total rating under 15, we need to notify a supervisor. That's easy enough with mailers, but I can't seem to access the…
Oranges13
  • 1,084
  • 1
  • 10
  • 33
0
votes
0 answers

When Can After Create Call Back Rollback?

The use case is we are having a lms_status model & in the model having after_create callback with if condition. I found that when if conditions is true then the code inside the after_create executed properly but in the lms_statuses table no entry…
0
votes
1 answer

Rails callback for after insert

I'm using a closure table to model the hierarchical structure of one of my models. As such, I am using an after_create hook to create the tree_path objects whenever Model.create is called. I would also like this hook to run whenever #new is called…
C-RAD
  • 1,052
  • 9
  • 18
0
votes
1 answer

Start method just once for addition / removal of association elements

I have a Composition model which has a has_and_belongs_to_many :authors. I need to fire a method after a composition changed its authors, although, since it involves the creation of a PDF file (with the name of the authors), I want to call this…
Simon
  • 701
  • 6
  • 25
0
votes
1 answer

Creating Multiple Associated Records After Creation of Parent Object

I have an application where users create Appointments, and each Appointment has a set of Skills attached to them through a Appointment_Skills table. There are about 50 or so Skills that I would like to attach to each appointment after creation.…
cjiro
  • 325
  • 2
  • 7
0
votes
0 answers

Ruby on Rails -- SystemStackError: stack level too deep

I added some after create do and before update do code to my model and now I cant save my posts btw both models(user & posts) have a has_and_belongs_to_many relationship: after_create do @post = Post.find(self.id) for user in …
user6059539
0
votes
1 answer

Why is the foreign key set to null when using the action 'after_create' in the model of a Rails app?

The following block of code is how my model looks. class MyModel < ActiveRecord::Base belongs_to :parent_model after_create :create_model after_update :update_model def create_model # some code goes here puts "Parent id: " +…
Dionis Beqiraj
  • 737
  • 1
  • 8
  • 31
0
votes
1 answer

adding an after_create method in Rails Admin

I'm using Rails 4.1 and Rails Admin. I have a Project Model with the following fields: name: slug: project_number. When I create a new project in the admin I want the project_number to be created automatically using the id and the slug. Like…
DeweyBanks
  • 17
  • 1
  • 5
0
votes
1 answer

After_create following relationship after Project Creation not working

I'm trying to allow users to create projects...and as soon as a user creates a project...they will automatically be following that project. (I have my app setup to allow a user to follow a project from a 'follow' button on the project profile). I…
BB500
  • 549
  • 2
  • 6
  • 24
0
votes
0 answers

JSF war file is automatically undeployed after deploying in to JBOSS 6.1 eap

We are trying to deploy the JSF war in JBOSS 6.1 eap. But after deploying the war file,it is un-deploying. Even though we tried like remove the temp and log folder.But there is no use .after 10 minites,it is getting un-deployed. Please suggest me to…
0
votes
1 answer

after_create in Rails with manual SQL query

I'm trying to create an object after another object is created, however the latter object is created using a SQL query rather than an ActiveRecord query. I am trying to create an EventCode when a new instance of xyz is created as below: class xyz <…
bob
  • 3
  • 1
0
votes
0 answers

Rails 4 before_save build & update ActiveRecords

On Rails 4, I am using Devise login. On first sign_in user gets directed to new_profile_path(@user) or profile_path(@profile = @user.profile_id). I am building the Profile ActiveRecord during User Registration. I'd like to pass the profile.id that…
0
votes
2 answers

rails - Auto create tasks after creating a project (after_create)

a newbie here. Just started to learn development. Any help would be greatly appreciated I have two models Project and Task. Each project will have 7 tasks. I want rails to auto create my 7 tasks after I create a project. My Task Controller def…
msiddique
  • 37
  • 7