[Rails] Class Variables - Static.

2014-05-26 Thread Rupesh Jayaprakash
Hello, When setting the class static variables, These are shared across all the instances created. Class A @@bool_var = true def get_bool_var @@bool_var end end All the instances will have this static variable, When through a controller, a user requests, Based on some logic, I set

[Rails] Re: Re: Use table elements

2014-05-26 Thread Fab Forestier
Colin Law wrote in post #1146856: On 23 May 2014 07:41, Fab Forestier li...@ruby-forum.com wrote: id_op2 name_op2num_op2button Be careful operation is not a model in this view but a variable. I don't know how to assign my variable in fonction of the button line? That is

[Rails] Re: Class Variables - Static.

2014-05-26 Thread Matt Jones
On Monday, 26 May 2014 03:16:26 UTC-4, Ruby-Forum.com User wrote: Hello, When setting the class static variables, These are shared across all the instances created. Class A @@bool_var = true def get_bool_var @@bool_var end end All the instances will have this

Re: [Rails] Use table elements

2014-05-26 Thread Walter Lee Davis
On May 26, 2014, at 4:28 AM, Fab Forestier wrote: Colin Law wrote in post #1146856: On 23 May 2014 07:41, Fab Forestier li...@ruby-forum.com wrote: id_op2 name_op2num_op2button Be careful operation is not a model in this view but a variable. I don't know how to assign

[Rails] Finding a record which I had created

2014-05-26 Thread Ronald Fischer
I thought this is an easy one, but: I have created a record, and later would like to retrieve it again. Here is an excerpt of my schema: create_table dicts, force: true do |t| t.string dictname ... end My model ensures that dictname is unique: validates :dictname,

Re: [Rails] Finding a record which I had created

2014-05-26 Thread Walter Lee Davis
On May 26, 2014, at 8:38 AM, Ronald Fischer wrote: I thought this is an easy one, but: I have created a record, and later would like to retrieve it again. Here is an excerpt of my schema: create_table dicts, force: true do |t| t.string dictname ... end My model ensures

Re: [Rails] Finding a record which I had created

2014-05-26 Thread Walter Lee Davis
Sorry, meant dictname:, not url: that's my app that has URLs, not yours. Walter On May 26, 2014, at 8:57 AM, Walter Lee Davis wrote: Dict.first_or_create(url: params[:dictname]) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] Re: Finding a record which I had created

2014-05-26 Thread Ronald Fischer
Walter Davis wrote in post #1147113: ActiveRecord already has a finder that can do all this in one line: Assuming that's the only thing needed to create or find an existing Dict, you should be all good there. No, it should not create one. If there is no suitable record, I want to display an

Re: [Rails] Re: Finding a record which I had created

2014-05-26 Thread Walter Lee Davis
On May 26, 2014, at 9:03 AM, Ronald Fischer wrote: Walter Davis wrote in post #1147113: ActiveRecord already has a finder that can do all this in one line: Assuming that's the only thing needed to create or find an existing Dict, you should be all good there. No, it should not create one.

[Rails] Re: Update views after change variables

2014-05-26 Thread Fab Forestier
mike2r wrote in post #1146701: On Wednesday, May 21, 2014 7:42:39 AM UTC-4, Ruby-Forum.com User wrote: format.json { head :no_content } respond_to do |format| -- Posted via http://www.ruby-forum.com/. The problem is the redirect. When you do a redirect, Rails actually

[Rails] Re: Use table elements

2014-05-26 Thread Fab Forestier
Walter Davis wrote in post #1147109: On May 26, 2014, at 4:28 AM, Fab Forestier wrote: htttp://localhost:3000/operations/some_action?value=73. You can easily do this with something like link_to(label, :controller=operations, :action=some_action, :value=73). Then in the action in the

[Rails] Re: Finding a record which I had created

2014-05-26 Thread Ronald Fischer
Thanks, I will try this! I wonder: Where do I find a specification for this feature? I guess Rails automatically generates this kind of find_by_... functions for each attribute in my model, which as uniqueness set. Where is this documented? My biggest problem with rails is getting from the API

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-26 Thread mike2r
On Sunday, May 25, 2014 1:40:40 PM UTC-4, Ruby-Forum.com User wrote: Thanks a lot for the detailed explanations. Two remarks for this: As for the naming, my application evolves a dictionary of foreign language idioms, and the main purpose it to train the user in the usage of these

Re: [Rails] Use table elements

2014-05-26 Thread Scott Ribe
On May 26, 2014, at 8:00 AM, Fab Forestier li...@ruby-forum.com wrote: But the in the methode ajouter how can I have something like @myvariable=n or @myvariable=@defautrec[i] where I is the current line of the table? %= link_to controller: pages, action: ajouter, id: n % But your code is

[Rails] Re: Use table elements

2014-05-26 Thread Fab Forestier
Scott Ribe wrote in post #1147132: On May 26, 2014, at 8:00 AM, Fab Forestier li...@ruby-forum.com wrote: But the in the methode ajouter how can I have something like @myvariable=n or @myvariable=@defautrec[i] where I is the current line of the table? %= link_to controller: pages, action:

Re: [Rails] Finding a record which I had created

2014-05-26 Thread Walter Lee Davis
This could be written as this: @dict = Dict.where(:dictname = dict_name).first It will either return a record, or nil. Walter On May 26, 2014, at 8:38 AM, Ronald Fischer wrote: if Dict.exists?(:dictname = dict_name) logger.debug('found dictionary with name '+dict_name)

Re: [Rails] Re: Use table elements

2014-05-26 Thread Walter Lee Davis
On May 26, 2014, at 10:00 AM, Fab Forestier wrote: Walter Davis wrote in post #1147109: On May 26, 2014, at 4:28 AM, Fab Forestier wrote: htttp://localhost:3000/operations/some_action?value=73. You can easily do this with something like link_to(label, :controller=operations,

Re: [Rails] Use table elements

2014-05-26 Thread Scott Ribe
On May 26, 2014, at 9:09 AM, Fab Forestier li...@ruby-forum.com wrote: And then how can use the id in my methode? Like any other parameter. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed

[Rails] Re: Update views after change variables

2014-05-26 Thread mike2r
On Monday, May 26, 2014 9:42:19 AM UTC-4, Ruby-Forum.com User wrote: mike2r wrote in post #1146701: On Wednesday, May 21, 2014 7:42:39 AM UTC-4, Ruby-Forum.com User wrote: format.json { head :no_content } respond_to do |format| -- Posted via

Re: [Rails] Re: Use table elements

2014-05-26 Thread Colin Law
On 26 May 2014 16:09, Fab Forestier li...@ruby-forum.com wrote: Scott Ribe wrote in post #1147132: On May 26, 2014, at 8:00 AM, Fab Forestier li...@ruby-forum.com wrote: But the in the methode ajouter how can I have something like @myvariable=n or @myvariable=@defautrec[i] where I is the

[Rails] Re: Class Variables - Static.

2014-05-26 Thread Rupesh Jayaprakash
Thank You Jones for your answer, I was suspecting that my class variable will not be the same at the same request. I understand that on a multi-process deployment things would be different. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to

[Rails] TypeError (can't cast Enumerator to string): - Ruby on Rails

2014-05-26 Thread Arup Rakshit
Hi, When I am trying to upload a file through the url - http://0.0.0.0:3000/upload/get . I am getting an error as Started POST /upload/save for 127.0.0.1 at 2014-05-27 01:29:29 +0530 Processing by UploadController#save as HTML Parameters: {utf8=✓,

[Rails] Re: Bar code reader and scanner integration

2014-05-26 Thread da hongdi
Google the question and found following thread on the same barcode scanninghttp://www.keepdynamic.com/dotnet-barcode-reader/issue. *https://www.ruby-forum.com/topic/3650119* -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] HTTPI::SSLError - Plz help

2014-05-26 Thread Usha Murali
Dear All, rvm ssl updated sucessfully and Openssl/ca cert seems to be correct in my system but still i get HTTPI::SSL Error, Plz help me , my environment as follows: $ whereis openssl openssl: /usr/bin/openssl /usr/include/openssl /usr/share/man/man1/openssl. 1ssl.gz $ env | grep -i ssl