need list of all aliases

32 views
Skip to first unread message

tom

unread,
Nov 25, 2014, 4:02:29 PM11/25/14
to Ruby on Rails: Talk
hi, 

im having this:
  alias_attribute "id" , "No_"
  alias_attribute "name" , "Name"
  alias_attribute "name2" , "Name 2"
  alias_attribute "address" , "Address"
#  alias_attribute "no_series" , "No Series"
#  alias_attribute "property_no" , "Property N

in my active record model. 
now i need a list of all the columnames which have been aliased. 

any ideas?

thx

Norm Scherer

unread,
Nov 25, 2014, 5:21:03 PM11/25/14
to rubyonra...@googlegroups.com
I assume you are using a linux system or something like that.  I would just use grep.  Something like 'find . -name \*rb|xargs grep alias_attribute'.

Of course I am an old Unix guy and there might be some other way of getting it.

Norm
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMdJ5%3D4YbwbOoArJKXi-ZbRGpTxduaTTQp%2BLDvbQ1TvHHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Frederick Cheung

unread,
Nov 26, 2014, 5:09:09 AM11/26/14
to rubyonra...@googlegroups.com


On Tuesday, November 25, 2014 9:02:29 PM UTC, der_tom wrote:
hi, 

im having this:
  alias_attribute "id" , "No_"
  alias_attribute "name" , "Name"
  alias_attribute "name2" , "Name 2"
  alias_attribute "address" , "Address"
#  alias_attribute "no_series" , "No Series"
#  alias_attribute "property_no" , "Property N

Model.attribute_aliases returns a hash with all the aliases.

Fred

tom

unread,
Nov 26, 2014, 11:53:23 AM11/26/14
to Ruby on Rails: Talk
fred,
cant find it in the docs, is that also available for r3.2?
thx

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Frederick Cheung

unread,
Nov 28, 2014, 5:52:26 AM11/28/14
to rubyonra...@googlegroups.com


On Wednesday, November 26, 2014 4:53:23 PM UTC, der_tom wrote:
fred,
cant find it in the docs, is that also available for r3.2?
thx


I've no idea. Did you try it?


tom

unread,
Nov 28, 2014, 9:56:38 AM11/28/14
to Ruby on Rails: Talk
4 - ok
3.2 - not ok

thx again


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages