Re: [Rails] how to display the terminal output to the page in real time.

2012-07-22 Thread Javier Quarite
Hi, you need something like pusher or maybe an ajax call that executes every 5 seconds (maybe more), depends on the amount of data you are going to retrieve (because it may crash your app) Javier Q. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta

[Rails] Re: Validation in ruby on rails

2012-07-22 Thread manoj c.
Rafi A wrote in post #1069463: > Manoj, > > try this in the model: > > validates_presence_of :name, :message => "can't be blank" > > Regards, > Seeni Rafiyullah Khan A, > Skype id: rafiyullah.railsfactory | +91 9786832092 | rafigl...@gmail.com > *In Every moment, thank God.* Thanks a lot sir. reg

[Rails] how to display the terminal output to the page in real time.

2012-07-22 Thread LAUT TOORE
Hi, I'm New Here and also with Ruby on Rails use ubuntu 12 My question would be, how to display the terminal output to the page in real time. I am doing the following. In the controller def run @terminal = IO.popen('./rcracki_mt -l hashtxt.txt -t 4 SHA1 ') end end In vie

[Rails] Re: Multiple associations to the same model

2012-07-22 Thread Matt Harrison
Got it working perfectly now. I'm not going to put much checking in, if I leave a couple of small gaps and something gets mis-associated, I can push harder for an overhaul of the dataset :) Thanks again -- Posted via http://www.ruby-forum.com/. -- You received this message because you are su

[Rails] Re: Multiple associations to the same model

2012-07-22 Thread Matt Harrison
Thanks guys, I will have a fiddle and see what I can do with your suggestions. It's really a rediculous way to keep the data and if it was up to me I can guarantee it would be done differently :) Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are su

Re: [Rails] Multiple associations to the same model

2012-07-22 Thread Hassan Schroeder
# two premature sends today; fingers sticking to keyboard here in # 90+degree San Jose - sorry! class Furniture < ActiveRecord::Base; end class Table < Furniture default_scope where( ... check id here... ) end class Chair < Furniture default_scope where( ...check id here... ) end HTH, --

Re: [Rails] Multiple associations to the same model

2012-07-22 Thread Hassan Schroeder
On Sun, Jul 22, 2012 at 2:13 PM, Matt Harrison wrote: > For example, lets say the dataset contains a list of furniture. Ids 1-10 > might be tables and 11-20 might be chairs. > > Lets say the other model defines a room. A room should be able to have > one table and one chair. Unfortunately, as the

Re: [Rails] Multiple associations to the same model

2012-07-22 Thread Dave Aronson
On Sun, Jul 22, 2012 at 5:13 PM, Matt Harrison wrote: > Lets say the other model defines a room. A room should be able to have > one table and one chair. Unfortunately, as they both refer to the same > model, I'm a loss on how to do it. You could have attributes called table and chair, each refe

[Rails] Multiple associations to the same model

2012-07-22 Thread Matt Harrison
I have a model which contains a large dataset which is unmodifiable. I contains a relation of ids to names for several item types lumped together, not idea I know. I have a model which needs two associations, both of which will link to this model above, but with different names. For example, lets

Re: [Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Gintautas Šimkus
I just want to make it explicit, that I've made quite a few errors in numbers because of poor editing. Still it stays at billions even for a 10-character hexadicamal (gmail says to put 'sp' here ;)). I myself realized the unlikeliness of a conflict by using GIT. I mean if GIT is good enough for kee

Re: [Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Gintautas Šimkus
Sure! Glad to have helped somewhat. It's a perception thing (at least it is for me). I mean a string of 10 symbols of hexadecimal characters (0-through-f) could have 16^10 outcomes (= over 1 trillion = 100 billions). So just a single random guess (like buying lottery ticket) would give you a 1 in /

Re: [Rails] Re: Find Company Name not ID

2012-07-22 Thread Hassan Schroeder
Apologies, fat-fingered premature send ... On Sun, Jul 22, 2012 at 9:07 AM, Hassan Schroeder wrote: > 3) Write a helper to return empty values for nil companies: > # untested example follows :-) company_info_for(contact.company, 'company_name') # replaces contact.company.compan

Re: [Rails] Re: Find Company Name not ID

2012-07-22 Thread Hassan Schroeder
On Sat, Jul 21, 2012 at 7:44 PM, James Harris wrote: > Using Walters solution has worked. contact.company.try(:company_name) > > So my understanding of this now is that because some of the contact > records have no company defined (a nil object or NilClass). By using > .try it responds nil if no c

Re: [Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Tsvetelina Borisova
Thanks I was looking exactly for answer like yours - Andrei's answer is cool and I only needed more theory on these unsubscribe links. Thanks Dihital :) 22 юли 2012, неделя, 17:41:54 UTC+3, Dihital написа: > > Andrei's solution works because with Device gem the User#auth_token is > randomly gen

Re: [Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Gintautas Šimkus
Andrei's solution works because with Device gem the User#auth_token is randomly generated and unique per your app. It would be extremely hard to brute-force it, that's why it's safe; though it would be a good idea to make sure you deny 4th or whichever unsuccessful try to use the same action in the

[Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Tsvetelina Borisova
Thanks for the quick response :) 22 юли 2012, неделя, 15:14:13 UTC+3, Андрей Большов написа: > > You should look at Devise gem Token Authenticatable solution as example. > You just add "?auth_token=#{@user.auth_token}" to your unsubsribe url. > > воскресенье, 22 июля 2012 г., 15:06:58 UTC+4 пользо

[Rails] Re: How to construct unsubscribe link?

2012-07-22 Thread Андрей Большов
You should look at Devise gem Token Authenticatable solution as example. You just add "?auth_token=#{@user.auth_token}" to your unsubsribe url. воскресенье, 22 июля 2012 г., 15:06:58 UTC+4 пользователь Tsvetelina Borisova написал: > > Hello. In my app I send emails to tell that the user has certi

[Rails] How to construct unsubscribe link?

2012-07-22 Thread Tsvetelina Borisova
Hello. In my app I send emails to tell that the user has certificate and I want to put a link - Unsubscribe. I don't know how to construct this link so that there won't be users that unsubscribe other users. I mean I want to make that is safe. I look in the web for how these unsubscribe links ar

Re: [Rails] translations for custom validation error messages

2012-07-22 Thread Norbert Melzer
Am 21.07.2012 02:21 schrieb "Ace Suares" : > > In validations, one can add a custom error message: > >> >> class Person < ActiveRecord::Base >> def a_method_used_for_validation_purposes errors.add(:name, I18n.t(:thekey)) #"cannot contain the characters !@#%*()_-+=") >> end >> end > > > How