Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9060007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:06:51+00:00 2026-06-16T15:06:51+00:00

I have model, and when i write into it, i’m using standart Model.create!(params[:somesymbol]) However

  • 0

I have model, and when i write into it, i’m using standart Model.create!(params[:somesymbol])
However in my form i have hidden field with current_user.id
current_user its variable from devise, which returns user that is logged. So when i create new record, i believe to user, that he didnt change value in hidden field. Is there any ways to avoid this, and write into model in some way like this
Model.create!(params[:somesymbol], user_id: current_user.id) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:06:52+00:00Added an answer on June 16, 2026 at 3:06 pm

    You can use :

    Model.create!(params[:somesymbol].merge(user_id: current_user.id))
    

    The user_id in params will be overridden by current_user.id (see doc)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using django to write a rather complicated object-oriented model for a
I have model Foo which has field bar. The bar field should be unique,
I have model Article it has field title with some text that may contain
I have model: # encoding: utf-8 class Tag include Mongoid::Document field :name, type: String
I have a model called Snippet, which contains snippets of HTML to push into
So I have bought into the thin controller, fat model guideline. That to me
I have a field in a model that I want users to feel like
I have the following model: class Entry include Mongoid::Document field :title, type: String field
Assuming that I have such model COLORS= ( ('R', 'Red'), ('B', 'Yellow'), ('G', 'White'),
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.