Jump to content

The ultimate community for Ruby on Rails developers.


How to add attributes to db without migration in rails?

ruby-on-rails content management system

  • Please log in to reply
5 replies to this topic

#1 Logesh



  • Members
  • 14 posts

Posted 19 November 2013 - 02:55 PM

I thought of building a sample app where i want to resemble the "STORAGE ROOM" process of adding attributes and display it as the column heading. To clearly explain, there is a process where we can add a collection in which we can add attributes and we can select the data type of the attribute and on saving those the values will be displayed as table column heading and we can fill in the values according to the field and its type.


I am also trying to do so. I do not want to add the attributes through migration. Is there is a possibility of doing it?


Could somebody explain how to do this?

#2 BitCamp



  • Members
  • 1 posts

Posted 19 November 2013 - 05:15 PM

Personally it does sound like a migration is going to be your best bet.  How many data attributes are you looking at dealing with?



#3 Ohm



  • Moderators
  • 529 posts
  • LocationCopenhagen

Posted 19 November 2013 - 07:28 PM

Could you give a more concrete example? I am having some trouble visualising your process.


I think you want to use some kind of serialisation. The downside here is that you'd need to process the data at all time you'd want to use it.

Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk

#4 Logesh



  • Members
  • 14 posts

Posted 20 November 2013 - 04:17 AM

I would like to create attributes the same way as they do in "Storageroom" cms. There is no limit in the attributes. we can create as many as the users require. I do not even know whether we should be creating attributes in the model or it should be some other way.

#5 Logesh



  • Members
  • 14 posts

Posted 20 November 2013 - 04:33 AM

I would like to create attributes the same way as they do in "Storageroom" cms. Instead of creating the attributes for the model by migration i need to pop up a window which shows up set of data types to choose and on selecting that it would ask for the name of the field and once completed and saved the attributes will appear on the index page as the column heading under which we can add values corresponding to the data type we selected. If possible, please look at the storageroom and you can clearly understand what i am trying to achieve. 

#6 Kevin



  • Members
  • 23 posts

Posted 21 November 2013 - 09:26 AM

not sure if I understand what you're trying to achieve, but my understanding so far, you can follow this : http://yehudakatz.co...e-activerecord/

Also tagged with one or more of these keywords: ruby-on-rails, content management system

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users