Hi,
I have used this method to generate random texts ....
def rendom_password
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
newpass = ""
1.upto(7) { |i| newpass << chars[rand(chars.size-1)] }
end
Thanks,
sri
my blog is abt wht i have learnt technically, mostly in Ruby on Rails, Javascript, node.js hope this share a little bit of info & adds a bit stuff., Thanks.
Tuesday, January 19, 2010
Wednesday, January 13, 2010
'Include' in rails query
For getting a datum from 2 tables, I have used include as follows,
Admin:
belongs_to :user
User:
has_many :admins
There was a condition that i have to sort names of admins, where the names of admins will be in user table.
Hence,
Admin.find(:all, :include=>"user", :order => "users.name")
I felt this easy than sqls, & interesting
Admin:
belongs_to :user
User:
has_many :admins
There was a condition that i have to sort names of admins, where the names of admins will be in user table.
Hence,
Admin.find(:all, :include=>"user", :order => "users.name")
I felt this easy than sqls, & interesting
Select Helper Methods in Rails
Hi,
Whenever i use a select Box in Rails, i have used this link.. This s really useful..
http://shiningthrough.co.uk/Select-helper-methods-in-Ruby-on-Rails
Thanks,
Srikanth
Tutorials: Ruby on Rails 3 Tutorial: Learn Rails by Example
| Ajax on Rails
| Rails 3 Way, The (2nd Edition) (Addison-Wesley Professional Ruby Series)
Whenever i use a select Box in Rails, i have used this link.. This s really useful..
http://shiningthrough.co.uk/Select-helper-methods-in-Ruby-on-Rails
Thanks,
Srikanth
Tutorials: Ruby on Rails 3 Tutorial: Learn Rails by Example
Subscribe to:
Posts (Atom)