# How to write a ruby code that add a new user's data to a user\_custom\_fields

**URL:** <https://meta.discourse.org/t/how-to-write-a-ruby-code-that-add-a-new-users-data-to-a-user-custom-fields/66662>\
**Category:** Product Support\
**Created:** [July 23, 2017, 9:04am UTC](https://meta.discourse.org/t/how-to-write-a-ruby-code-that-add-a-new-users-data-to-a-user-custom-fields/66662 "2017-07-23T09:04:15Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)\
**Post date:** [July 23, 2017, 9:04am UTC](https://meta.discourse.org/t/how-to-write-a-ruby-code-that-add-a-new-users-data-to-a-user-custom-fields/66662/1 "2017-07-23T09:04:15Z")

</div>

I am not familiar with rails so much and I want to code a plugin that asks user his job and fill the job’s user\_custom\_fields(already created manually) in the database.

Because I’m familiar with PHP, I add new rows to database directly by SQL Queries (Like what we do in PHP) But this won’t increase the sequence table and this may cause some damages to site.

I have tried to increase the sequence table but postgres didn’t allow me to change data in `_seq` tables.

I have two solution:

1-get the permission to edit rows in `_seq` tables and change them with SQL Query.

2-edit or add the database using rails methods.(that increase the `_seq` tables automatically)

Surely, the second solution is the best but this solution is good for who are familiar with rails and MVC and for me and as a temporary solution(to avoid big harms) the first solution is good until I learn how to code with Rails.

So how Can I solve this problem? What is your Idea?

---

_[View the full topic](https://meta.discourse.org/t/how-to-write-a-ruby-code-that-add-a-new-users-data-to-a-user-custom-fields/66662)._
