How to update created_by field in scaffolding generated code?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I use devise gem for authentication. I generated a scaffold for model M. I would like to update the created_by field with the user id from the login page. How do I achieve this?



I have 2 fields in the model F1 and F2.



The form that scaffold creates shows input for users to enter values for F1 and F2. How do I update the value for created_by field using the current_user from devise? Because the create action seems to be entering only the fields from the form.



<%= form_with(model: M, local: true) do |form| %>
<% if M.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(M.errors.count, "error") %> prohibited this movie from being saved:</h2>

<ul>
<% M.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= form.label :F1 %>
<%= form.text_field :F1 %>
</div>

<div class="field">
<%= form.label :F2 %>
<%= form.text_field :F2 %>
</div>

<div class="actions">
<%= form.submit %>
</div>
<% end %>


How to I update the model with current_user value in the above form without exposing that field to the user?



This is my controller:



class MsController < ApplicationController
before_action :set_M, only: [:show, :edit, :update, :destroy]

# GET /Ms
# GET /Ms.json
def index
@Ms = M.all

@categories = @Ms.uniq.pluck(:category)
@Ms_by_category = Hash.new

@categories.each do |category|
@Ms_by_category[category] = M.where(:category => category)
end
end

# GET /Ms/1
# GET /Ms/1.json
def show
end

# GET /Ms/new
def new
@M = M.new
end

# GET /Ms/1/edit
def edit
end

# POST /Ms
# POST /Ms.json
def create
@M = M.new(M_params)

respond_to do |format|
if @M.save
format.html { redirect_to @M, notice: 'M was successfully created.' }
format.json { render :show, status: :created, location: @M }
else
format.html { render :new }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /Ms/1
# PATCH/PUT /Ms/1.json
def update
respond_to do |format|
if @M.update(M_params)
format.html { redirect_to @M, notice: 'M was successfully updated.' }
format.json { render :show, status: :ok, location: @M }
else
format.html { render :edit }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# DELETE /Ms/1
# DELETE /Ms/1.json
def destroy
@M.destroy
respond_to do |format|
format.html { redirect_to Ms_url, notice: 'M was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_M
@M = M.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def M_params
params.require(:M).permit(:title, :category, :rating)
end
end









share|improve this question

























  • Please, add corresponding controller action to the question

    – Vasilisa
    Jan 5 at 8:28











  • I have updated my question with the controller code. Thanks!

    – Biju
    Jan 5 at 8:33











  • @Vasilisa - please help!

    – Biju
    Jan 5 at 9:09











  • What do you want to store in created_by field? User's id or email or something else?

    – Vasilisa
    Jan 5 at 9:22











  • Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

    – Biju
    Jan 5 at 10:20


















0















I use devise gem for authentication. I generated a scaffold for model M. I would like to update the created_by field with the user id from the login page. How do I achieve this?



I have 2 fields in the model F1 and F2.



The form that scaffold creates shows input for users to enter values for F1 and F2. How do I update the value for created_by field using the current_user from devise? Because the create action seems to be entering only the fields from the form.



<%= form_with(model: M, local: true) do |form| %>
<% if M.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(M.errors.count, "error") %> prohibited this movie from being saved:</h2>

<ul>
<% M.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= form.label :F1 %>
<%= form.text_field :F1 %>
</div>

<div class="field">
<%= form.label :F2 %>
<%= form.text_field :F2 %>
</div>

<div class="actions">
<%= form.submit %>
</div>
<% end %>


How to I update the model with current_user value in the above form without exposing that field to the user?



This is my controller:



class MsController < ApplicationController
before_action :set_M, only: [:show, :edit, :update, :destroy]

# GET /Ms
# GET /Ms.json
def index
@Ms = M.all

@categories = @Ms.uniq.pluck(:category)
@Ms_by_category = Hash.new

@categories.each do |category|
@Ms_by_category[category] = M.where(:category => category)
end
end

# GET /Ms/1
# GET /Ms/1.json
def show
end

# GET /Ms/new
def new
@M = M.new
end

# GET /Ms/1/edit
def edit
end

# POST /Ms
# POST /Ms.json
def create
@M = M.new(M_params)

respond_to do |format|
if @M.save
format.html { redirect_to @M, notice: 'M was successfully created.' }
format.json { render :show, status: :created, location: @M }
else
format.html { render :new }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /Ms/1
# PATCH/PUT /Ms/1.json
def update
respond_to do |format|
if @M.update(M_params)
format.html { redirect_to @M, notice: 'M was successfully updated.' }
format.json { render :show, status: :ok, location: @M }
else
format.html { render :edit }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# DELETE /Ms/1
# DELETE /Ms/1.json
def destroy
@M.destroy
respond_to do |format|
format.html { redirect_to Ms_url, notice: 'M was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_M
@M = M.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def M_params
params.require(:M).permit(:title, :category, :rating)
end
end









share|improve this question

























  • Please, add corresponding controller action to the question

    – Vasilisa
    Jan 5 at 8:28











  • I have updated my question with the controller code. Thanks!

    – Biju
    Jan 5 at 8:33











  • @Vasilisa - please help!

    – Biju
    Jan 5 at 9:09











  • What do you want to store in created_by field? User's id or email or something else?

    – Vasilisa
    Jan 5 at 9:22











  • Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

    – Biju
    Jan 5 at 10:20














0












0








0








I use devise gem for authentication. I generated a scaffold for model M. I would like to update the created_by field with the user id from the login page. How do I achieve this?



I have 2 fields in the model F1 and F2.



The form that scaffold creates shows input for users to enter values for F1 and F2. How do I update the value for created_by field using the current_user from devise? Because the create action seems to be entering only the fields from the form.



<%= form_with(model: M, local: true) do |form| %>
<% if M.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(M.errors.count, "error") %> prohibited this movie from being saved:</h2>

<ul>
<% M.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= form.label :F1 %>
<%= form.text_field :F1 %>
</div>

<div class="field">
<%= form.label :F2 %>
<%= form.text_field :F2 %>
</div>

<div class="actions">
<%= form.submit %>
</div>
<% end %>


How to I update the model with current_user value in the above form without exposing that field to the user?



This is my controller:



class MsController < ApplicationController
before_action :set_M, only: [:show, :edit, :update, :destroy]

# GET /Ms
# GET /Ms.json
def index
@Ms = M.all

@categories = @Ms.uniq.pluck(:category)
@Ms_by_category = Hash.new

@categories.each do |category|
@Ms_by_category[category] = M.where(:category => category)
end
end

# GET /Ms/1
# GET /Ms/1.json
def show
end

# GET /Ms/new
def new
@M = M.new
end

# GET /Ms/1/edit
def edit
end

# POST /Ms
# POST /Ms.json
def create
@M = M.new(M_params)

respond_to do |format|
if @M.save
format.html { redirect_to @M, notice: 'M was successfully created.' }
format.json { render :show, status: :created, location: @M }
else
format.html { render :new }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /Ms/1
# PATCH/PUT /Ms/1.json
def update
respond_to do |format|
if @M.update(M_params)
format.html { redirect_to @M, notice: 'M was successfully updated.' }
format.json { render :show, status: :ok, location: @M }
else
format.html { render :edit }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# DELETE /Ms/1
# DELETE /Ms/1.json
def destroy
@M.destroy
respond_to do |format|
format.html { redirect_to Ms_url, notice: 'M was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_M
@M = M.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def M_params
params.require(:M).permit(:title, :category, :rating)
end
end









share|improve this question
















I use devise gem for authentication. I generated a scaffold for model M. I would like to update the created_by field with the user id from the login page. How do I achieve this?



I have 2 fields in the model F1 and F2.



The form that scaffold creates shows input for users to enter values for F1 and F2. How do I update the value for created_by field using the current_user from devise? Because the create action seems to be entering only the fields from the form.



<%= form_with(model: M, local: true) do |form| %>
<% if M.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(M.errors.count, "error") %> prohibited this movie from being saved:</h2>

<ul>
<% M.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= form.label :F1 %>
<%= form.text_field :F1 %>
</div>

<div class="field">
<%= form.label :F2 %>
<%= form.text_field :F2 %>
</div>

<div class="actions">
<%= form.submit %>
</div>
<% end %>


How to I update the model with current_user value in the above form without exposing that field to the user?



This is my controller:



class MsController < ApplicationController
before_action :set_M, only: [:show, :edit, :update, :destroy]

# GET /Ms
# GET /Ms.json
def index
@Ms = M.all

@categories = @Ms.uniq.pluck(:category)
@Ms_by_category = Hash.new

@categories.each do |category|
@Ms_by_category[category] = M.where(:category => category)
end
end

# GET /Ms/1
# GET /Ms/1.json
def show
end

# GET /Ms/new
def new
@M = M.new
end

# GET /Ms/1/edit
def edit
end

# POST /Ms
# POST /Ms.json
def create
@M = M.new(M_params)

respond_to do |format|
if @M.save
format.html { redirect_to @M, notice: 'M was successfully created.' }
format.json { render :show, status: :created, location: @M }
else
format.html { render :new }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /Ms/1
# PATCH/PUT /Ms/1.json
def update
respond_to do |format|
if @M.update(M_params)
format.html { redirect_to @M, notice: 'M was successfully updated.' }
format.json { render :show, status: :ok, location: @M }
else
format.html { render :edit }
format.json { render json: @M.errors, status: :unprocessable_entity }
end
end
end

# DELETE /Ms/1
# DELETE /Ms/1.json
def destroy
@M.destroy
respond_to do |format|
format.html { redirect_to Ms_url, notice: 'M was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_M
@M = M.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def M_params
params.require(:M).permit(:title, :category, :rating)
end
end






ruby-on-rails scaffolding






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 5 at 8:32







Biju

















asked Jan 4 at 2:29









BijuBiju

649




649













  • Please, add corresponding controller action to the question

    – Vasilisa
    Jan 5 at 8:28











  • I have updated my question with the controller code. Thanks!

    – Biju
    Jan 5 at 8:33











  • @Vasilisa - please help!

    – Biju
    Jan 5 at 9:09











  • What do you want to store in created_by field? User's id or email or something else?

    – Vasilisa
    Jan 5 at 9:22











  • Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

    – Biju
    Jan 5 at 10:20



















  • Please, add corresponding controller action to the question

    – Vasilisa
    Jan 5 at 8:28











  • I have updated my question with the controller code. Thanks!

    – Biju
    Jan 5 at 8:33











  • @Vasilisa - please help!

    – Biju
    Jan 5 at 9:09











  • What do you want to store in created_by field? User's id or email or something else?

    – Vasilisa
    Jan 5 at 9:22











  • Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

    – Biju
    Jan 5 at 10:20

















Please, add corresponding controller action to the question

– Vasilisa
Jan 5 at 8:28





Please, add corresponding controller action to the question

– Vasilisa
Jan 5 at 8:28













I have updated my question with the controller code. Thanks!

– Biju
Jan 5 at 8:33





I have updated my question with the controller code. Thanks!

– Biju
Jan 5 at 8:33













@Vasilisa - please help!

– Biju
Jan 5 at 9:09





@Vasilisa - please help!

– Biju
Jan 5 at 9:09













What do you want to store in created_by field? User's id or email or something else?

– Vasilisa
Jan 5 at 9:22





What do you want to store in created_by field? User's id or email or something else?

– Vasilisa
Jan 5 at 9:22













Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

– Biju
Jan 5 at 10:20





Actually - my ultimate goal is this - I would like ONLY the user who created an M to be able to perform CRUD operations on it. So I thought if we could store the user id (which happens to be email in my case) along with the data for M, then I could easily include this restriction. Or would there be a better way (or some built-in approach already provided by either Rails or devise

– Biju
Jan 5 at 10:20












2 Answers
2






active

oldest

votes


















1














You need to add users reference to M model and add associations. created_by is not the best name for it. Let imagine that M is abbreviation for Music. In this case you need to create a migration



add_reference :musics, :user


Add to the Music model



belongs_to :user


And to the User model



has_many :musics


And change in the controller



def new
@music = current_user.musics.new
end

def create
@music = current_user.musics.new(M_params)

respond_to do |format|
if @music.save
format.html { redirect_to @music, notice: 'Music was successfully created.' }
format.json { render :show, status: :created, location: @music }
else
format.html { render :new }
format.json { render json: @music.errors, status: :unprocessable_entity }
end
end
end





share|improve this answer
























  • That worked like a charm!! Thanks a lot!

    – Biju
    Jan 5 at 13:22



















2














So simple in creating action change your method, for example, you just need to create the client



before_action :authenticate_user!

def create
@client = Client.new(name: params[:name], address: params[:address],created_by: current_user.email )
if @client.save
redirect_to @client
else
render 'new'
end
end


There should be a field like created_by exist in the table.






share|improve this answer
























  • Thanks much for the reply. Should this be in the ApplicationController?

    – Biju
    Jan 4 at 6:48











  • would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

    – Biju
    Jan 4 at 18:35











  • @Vasilisa - would you be able to help me with issue this please?! Thanks!

    – Biju
    Jan 5 at 8:09














Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032436%2fhow-to-update-created-by-field-in-scaffolding-generated-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You need to add users reference to M model and add associations. created_by is not the best name for it. Let imagine that M is abbreviation for Music. In this case you need to create a migration



add_reference :musics, :user


Add to the Music model



belongs_to :user


And to the User model



has_many :musics


And change in the controller



def new
@music = current_user.musics.new
end

def create
@music = current_user.musics.new(M_params)

respond_to do |format|
if @music.save
format.html { redirect_to @music, notice: 'Music was successfully created.' }
format.json { render :show, status: :created, location: @music }
else
format.html { render :new }
format.json { render json: @music.errors, status: :unprocessable_entity }
end
end
end





share|improve this answer
























  • That worked like a charm!! Thanks a lot!

    – Biju
    Jan 5 at 13:22
















1














You need to add users reference to M model and add associations. created_by is not the best name for it. Let imagine that M is abbreviation for Music. In this case you need to create a migration



add_reference :musics, :user


Add to the Music model



belongs_to :user


And to the User model



has_many :musics


And change in the controller



def new
@music = current_user.musics.new
end

def create
@music = current_user.musics.new(M_params)

respond_to do |format|
if @music.save
format.html { redirect_to @music, notice: 'Music was successfully created.' }
format.json { render :show, status: :created, location: @music }
else
format.html { render :new }
format.json { render json: @music.errors, status: :unprocessable_entity }
end
end
end





share|improve this answer
























  • That worked like a charm!! Thanks a lot!

    – Biju
    Jan 5 at 13:22














1












1








1







You need to add users reference to M model and add associations. created_by is not the best name for it. Let imagine that M is abbreviation for Music. In this case you need to create a migration



add_reference :musics, :user


Add to the Music model



belongs_to :user


And to the User model



has_many :musics


And change in the controller



def new
@music = current_user.musics.new
end

def create
@music = current_user.musics.new(M_params)

respond_to do |format|
if @music.save
format.html { redirect_to @music, notice: 'Music was successfully created.' }
format.json { render :show, status: :created, location: @music }
else
format.html { render :new }
format.json { render json: @music.errors, status: :unprocessable_entity }
end
end
end





share|improve this answer













You need to add users reference to M model and add associations. created_by is not the best name for it. Let imagine that M is abbreviation for Music. In this case you need to create a migration



add_reference :musics, :user


Add to the Music model



belongs_to :user


And to the User model



has_many :musics


And change in the controller



def new
@music = current_user.musics.new
end

def create
@music = current_user.musics.new(M_params)

respond_to do |format|
if @music.save
format.html { redirect_to @music, notice: 'Music was successfully created.' }
format.json { render :show, status: :created, location: @music }
else
format.html { render :new }
format.json { render json: @music.errors, status: :unprocessable_entity }
end
end
end






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 5 at 10:34









VasilisaVasilisa

3,03421223




3,03421223













  • That worked like a charm!! Thanks a lot!

    – Biju
    Jan 5 at 13:22



















  • That worked like a charm!! Thanks a lot!

    – Biju
    Jan 5 at 13:22

















That worked like a charm!! Thanks a lot!

– Biju
Jan 5 at 13:22





That worked like a charm!! Thanks a lot!

– Biju
Jan 5 at 13:22













2














So simple in creating action change your method, for example, you just need to create the client



before_action :authenticate_user!

def create
@client = Client.new(name: params[:name], address: params[:address],created_by: current_user.email )
if @client.save
redirect_to @client
else
render 'new'
end
end


There should be a field like created_by exist in the table.






share|improve this answer
























  • Thanks much for the reply. Should this be in the ApplicationController?

    – Biju
    Jan 4 at 6:48











  • would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

    – Biju
    Jan 4 at 18:35











  • @Vasilisa - would you be able to help me with issue this please?! Thanks!

    – Biju
    Jan 5 at 8:09


















2














So simple in creating action change your method, for example, you just need to create the client



before_action :authenticate_user!

def create
@client = Client.new(name: params[:name], address: params[:address],created_by: current_user.email )
if @client.save
redirect_to @client
else
render 'new'
end
end


There should be a field like created_by exist in the table.






share|improve this answer
























  • Thanks much for the reply. Should this be in the ApplicationController?

    – Biju
    Jan 4 at 6:48











  • would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

    – Biju
    Jan 4 at 18:35











  • @Vasilisa - would you be able to help me with issue this please?! Thanks!

    – Biju
    Jan 5 at 8:09
















2












2








2







So simple in creating action change your method, for example, you just need to create the client



before_action :authenticate_user!

def create
@client = Client.new(name: params[:name], address: params[:address],created_by: current_user.email )
if @client.save
redirect_to @client
else
render 'new'
end
end


There should be a field like created_by exist in the table.






share|improve this answer













So simple in creating action change your method, for example, you just need to create the client



before_action :authenticate_user!

def create
@client = Client.new(name: params[:name], address: params[:address],created_by: current_user.email )
if @client.save
redirect_to @client
else
render 'new'
end
end


There should be a field like created_by exist in the table.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 4 at 5:55









Cryptex TechnologiesCryptex Technologies

810213




810213













  • Thanks much for the reply. Should this be in the ApplicationController?

    – Biju
    Jan 4 at 6:48











  • would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

    – Biju
    Jan 4 at 18:35











  • @Vasilisa - would you be able to help me with issue this please?! Thanks!

    – Biju
    Jan 5 at 8:09





















  • Thanks much for the reply. Should this be in the ApplicationController?

    – Biju
    Jan 4 at 6:48











  • would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

    – Biju
    Jan 4 at 18:35











  • @Vasilisa - would you be able to help me with issue this please?! Thanks!

    – Biju
    Jan 5 at 8:09



















Thanks much for the reply. Should this be in the ApplicationController?

– Biju
Jan 4 at 6:48





Thanks much for the reply. Should this be in the ApplicationController?

– Biju
Jan 4 at 6:48













would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

– Biju
Jan 4 at 18:35





would you mind explaining your code a bit please? I wanted to save model M along with current_user - I don't quite understand how your code accomplishes that. I guess I am missing something. Please help!

– Biju
Jan 4 at 18:35













@Vasilisa - would you be able to help me with issue this please?! Thanks!

– Biju
Jan 5 at 8:09







@Vasilisa - would you be able to help me with issue this please?! Thanks!

– Biju
Jan 5 at 8:09




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032436%2fhow-to-update-created-by-field-in-scaffolding-generated-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'