[Rails] image_submit_tag

2010-08-18 Thread Srikanth Jeeva
Hi Im using image_submit_tag to submit my form. works fine.. but the image is displayed with border. I used border => 0 but no use. This is my code. <%= image_submit_tag "../images/upload.png", :border => 0 %> any ideas?? Regards, Srikanth -- Posted via http://www.ruby-forum.com/. -- You r

Re: [Rails] Re: Re: Re: Removing just leading and trailing newline characters

2010-08-18 Thread rajeevsharma86
cheers :) On Thu, Aug 19, 2010 at 11:47 AM, Priya Saini wrote: > Hey thanks Rajeev.. It worked.. > Was doing a silly mistake.. > > Priya Saini wrote: > > Didnt help. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups

[Rails] Re: Re: Re: Removing just leading and trailing newline characters

2010-08-18 Thread Priya Saini
Hey thanks Rajeev.. It worked.. Was doing a silly mistake.. Priya Saini wrote: > Didnt help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t..

Re: [Rails] Re: before_filter :except => [:controller => :main_menu] ??? do we have such thing

2010-08-18 Thread Jim Croft
On 19 Aug 2010, at 01:11, Mark Hamil wrote: > Yeah I'm using the skip_before_filter method too, > but still, it seems it would be better if you could specify a > controller/action like your original posts suggests > > before_filter :custom_filter, :except => {:controler=>:action} before_filte

[Rails] Re: help needed to create a complex form

2010-08-18 Thread flyerhzm
Hi, Be sure you have build the document for message before you use it. On 8月19日, 下午1时08分, Tom Mac wrote: > Hi >    Thanks for replying.I could do it partially with the following > modifications to my models and views > > message_thread > >   has_many messages >   accepts_nes

[Rails] Re: Re: Re: Removing just leading and trailing newline characters

2010-08-18 Thread Priya Saini
Didnt help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-tal

[Rails] Composite primary keys and :joins=>

2010-08-18 Thread JeffV
I have a legacy db with the following simplified structure: Table-A: type_key, code_key, name, ... # PKs are type_key and code_key, there is no id col and I cannot alter this db Table-B: # each row has only the code as a foreign_key, the type_key is hard-coded to "FOOKEY" an_id, code, ...

Re: [Rails] Re: Help: "500 Internal Server Error"

2010-08-18 Thread rajeevsharma86
hey what was that line please suggest On Thu, Aug 19, 2010 at 10:49 AM, Jeff Wang wrote: > Tim Teng wrote: > > C:/rails/admin/app/controllers/application_controller.rb:2 > > i comment out that line then it works, great. > > thx. > -- > Posted via http://www.ruby-forum.com/. > > -- > You received

Re: [Rails] Re: Re: Removing just leading and trailing newline characters

2010-08-18 Thread rajeevsharma86
try this *validate :striped_descriptions def striped_descriptions # striping_description unless self.description.nil? logger.debug 'self.description before strip' logger.debug self.description striped_description = (self.description).strip self.description =

[Rails] Re: help needed to create a complex form

2010-08-18 Thread Tom Mac
Hi Thanks for replying.I could do it partially with the following modifications to my models and views message_thread has_many messages accepts_nested_attributes_for :messages message == belongs_to message_thread has_many :document_messages has_many

[Rails] Re: Help: "500 Internal Server Error"

2010-08-18 Thread Jeff Wang
Tim Teng wrote: > C:/rails/admin/app/controllers/application_controller.rb:2 i comment out that line then it works, great. thx. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this g

[Rails] Re: Re: Removing just leading and trailing newline characters

2010-08-18 Thread Priya Saini
Hi: Its a simple form to create a job. FCKeditor has been placed with the name job[description]. At the create event, it assigns the value to @job.description. I was trying to strip it before saving like: @job.description = params[:job][:description].strip, but it isnt solving the purpose. In t

Re: [Rails] Re: Removing just leading and trailing newline characters

2010-08-18 Thread rajeevsharma86
Explain yours purpose here put some lines of code i will tell you the way do something in model before_save : strip_description def strip_description unless !self.description.nil? self.description = self.description.strip # or whatever please check that how to # impleme

[Rails] Re: Removing just leading and trailing newline characters

2010-08-18 Thread Priya Saini
Thanks for ur instant reply Rajeev. On irb strip is working exactly the way i want but inside code it isn't solving the purpose. rajeevsharma86 wrote: > you may use strip > > http://ruby-doc.org/core/classes/String.src/M000820.html > or any else as required . > > On Thu, Aug 19, 2010 at 9:59 AM

Re: [Rails] Removing just leading and trailing newline characters

2010-08-18 Thread rajeevsharma86
you may use strip http://ruby-doc.org/core/classes/String.src/M000820.html or any else as required . On Thu, Aug 19, 2010 at 9:59 AM, Priya Saini wrote: > Hi: > > I am using FCKeditor in one of my form, when i copy and paste something > into it using WordPaste, it appends few newlines at the be

Re: [Rails] Help: "500 Internal Server Error"

2010-08-18 Thread Xianggong
C:/rails/admin/app/controllers/application_controller.rb:2 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-

[Rails] Removing just leading and trailing newline characters

2010-08-18 Thread Priya Saini
Hi: I am using FCKeditor in one of my form, when i copy and paste something into it using WordPaste, it appends few newlines at the beginning and at the end. How can i strip just those \n without effecting the inbetween newlines and the formatting. TIA, Priya -- Posted via http://www.ruby-forum

[Rails] Help: "500 Internal Server Error"

2010-08-18 Thread Jeff Wang
Hi guys, I am a completely ruby & rails newbie. i have being struggling on this issue for almost 2 days, still can not figure out the problem. there are two websites i'm trying to set up a development environment on my pc running windows xp 32 bit version. a front-end customer facing page & back-

[Rails] Re: Ruby question, max length of strings

2010-08-18 Thread Paul Harrington
Paul Harrington wrote: > Jeffrey L. Taylor wrote: >> Am I correct in assuming that the max length of a string is 65,535 on a >> 32 bit >> platform? Anyway around this, other classes, 64 bit platform? >> >> TIA, >> Jeffrey > > What would make you assume this? Simplest demonstration: > > irb(m

[Rails] Re: Ruby question, max length of strings

2010-08-18 Thread Paul Harrington
Jeffrey L. Taylor wrote: > Am I correct in assuming that the max length of a string is 65,535 on a > 32 bit > platform? Anyway around this, other classes, 64 bit platform? > > TIA, > Jeffrey What would make you assume this? Simplest demonstration: irb(main):004:0> s = "a"*7;nil => nil ir

[Rails] Re: has_many :through question

2010-08-18 Thread Allen Walker
Disregard, solution found. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to r

[Rails] has_many :through question

2010-08-18 Thread Allen Walker
I am trying to create an association table using the ":through" option in "has_many" but not having success. I have created the necessary migrations of the association tables and run rake db:migrate I have the following model: class Group < ActiveRecord::Base has_many :users, :through => :group

Re: [Rails] <>

2010-08-18 Thread jason white
Open a terminal, navigate to the /opt/rubystack-2.0-0 folder, and run "sudo ./ctlscript.sh start" On Wed, Aug 18, 2010 at 7:46 PM, Rich d wrote: > I have virtual machine and virtual rails installed on my machine. I > opened up a terminal to start the rubystack version of MySQL by typing > the

[Rails] Ruby question, max length of strings

2010-08-18 Thread Jeffrey L. Taylor
Am I correct in assuming that the max length of a string is 65,535 on a 32 bit platform? Anyway around this, other classes, 64 bit platform? TIA, Jeffrey -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send emai

[Rails] <>

2010-08-18 Thread Rich d
I have virtual machine and virtual rails installed on my machine. I opened up a terminal to start the rubystack version of MySQL by typing the following: /opt/rubystack-2.0-0 when I do this I get the following message: bash: /opt/rubystack-2.0-0: is a directory I am new to this and this is wha

[Rails] Re: before_filter :except => [:controller => :main_menu] ??? do we have such thing

2010-08-18 Thread Mark Hamil
Yeah I'm using the skip_before_filter method too, but still, it seems it would be better if you could specify a controller/action like your original posts suggests before_filter :custom_filter, :except => {:controler=>:action} that way you can include the filter on everything by applying it to t

[Rails] Re: Student-course system

2010-08-18 Thread Prash Padm
Thanks. I understood the models and controllers. I'm not able to understand how to add the code when it comes to enrolling students. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to th

[Rails] Re: Windowed Postgres Query

2010-08-18 Thread Marnen Laibow-Koser
Mindtonic wrote: > Hello. I have a database query I am trying to develop. OK...but note that your question has absolutely nothing to do with Rails, and would be better asked in an SQL forum. > > For the purpose of explanation, I am going to use a suit of playing > cards in ascending order as a

[Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Me
sorry I misread your tables. The has_many :through is looking for a join table with ids for both sides which is the cause of the error, same kind of table as a HABTM join table. class Author < ActiveRecord::Base has_many :authorships has_many :books, :through => :authorships end clas

[Rails] Re: Windowed Postgres Query

2010-08-18 Thread Frederick Cheung
On Aug 18, 10:44 pm, Mindtonic wrote: > Requesting 2 => [2, 3, 4, 5, 6] > Requesting K => [10, J, Q, K, A] > > If this query is run against a set with less than 5 records, it > returns all 5 records. > > What function, approach or theory should I utilize to accomplish > this?  What would the que

Re: [Rails] Re: RE: postgresql duplicate key violates unique constraint

2010-08-18 Thread Philip Hallstrom
> I ran into this issue when I backuped a database and restored it back > into another system. You might want to look into how that database got backed up. By default (at least every where I've done it) pg_dump will include the statements necessary to "reset" the sequences... that is, all my d

[Rails] Windowed Postgres Query

2010-08-18 Thread Mindtonic
Hello. I have a database query I am trying to develop. For the purpose of explanation, I am going to use a suit of playing cards in ascending order as an example. The complete data set would look like this: [2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A] The WHERE clause would contain "suit = hearts"

[Rails] Re: Problems installing Flotilla - no such file -- FileUtils

2010-08-18 Thread Matthias Bauer
Just in case you haven't solved this yet: Install the plugin from http://github.com/jhaagmans/flotilla.git instead - FileUtils is now 'fileutils'. -Matt On Jul 6, 3:53 pm, Colin Law wrote: > Hi > > I am attempting to install the Flotilla plugin for the flot javascript > charting library. > > I h

[Rails] Re: Creating Rails/jQuery/DataMapper application

2010-08-18 Thread Marnen Laibow-Koser
Hussein B wrote: > Hey, > I want to create a Rails project that uses jQuery and DataMapper. > Is it possible? > If yes, would you please tell me how. > Thanks all. http://lmgtfy.com/?q=rails+jquery http://lmgtfy.com/?q=rails+datamapper Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@ma

[Rails] Re: RE: postgresql duplicate key violates unique constraint

2010-08-18 Thread Fernando Perez
I ran into this issue when I backuped a database and restored it back into another system. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@g

[Rails] Re: How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Marnen Laibow-Koser
Parker Selbert wrote: > Marnen Laibow-Koser wrote: >> >> What's the advantage of not using sudo for gems? And for Rails 2.x, why >> would you want anything past 1.8.7? > > Aside from the security aspect, which isn't something I'm concerned > about in this context, there is just the simplificat

[Rails] Re: How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Parker Selbert
Marnen Laibow-Koser wrote: > > What's the advantage of not using sudo for gems? And for Rails 2.x, why > would you want anything past 1.8.7? Aside from the security aspect, which isn't something I'm concerned about in this context, there is just the simplification. Getting identical, portable

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread Robert Walker
IAmNan wrote: > I've put the relevant code here: http://pastie.org/1100297 > > So you know what's happening, the farmer creates a Production, which > creates one or more Supplies, which may create one or more Exchanges > if there are any Demands that match the Supply. > > The Exchange is supposed

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread Frederick Cheung
On Aug 18, 6:24 pm, IAmNan wrote: > > On exchange.rb#18 where the debugger stops, the values of > demand.available and supply.available have been correctly decremented. > After I let the code continue, they are back to their original values. > It doesn't look your saving the supply & semand obj

Re: [Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Rick R
On Wed, Aug 18, 2010 at 4:00 PM, Me wrote: > oh you need to add the has_many for the join table > > has_many :meter_goup > has_many :meters, :through => :meter_group > > I take it you mean on the Subscription table? which currently looks like: class Subscription < ActiveRecord::Base belongs_t

[Rails] Re: RE: postgresql duplicate key violates unique constraint

2010-08-18 Thread Marnen Laibow-Koser
Warren Seltzer wrote: > I think the requirement to manually reset the index is a bug in > postgresql. Either in > implementation or design. I've never needed to do that. I wonder why...would autovacuum help? Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via ht

[Rails] Re: Locales

2010-08-18 Thread Marnen Laibow-Koser
Jan Kadera wrote: > Hello, > can sbdy please be so kind and tell me in a few words how to solve the > following problem. > > I have just deployed an application. > I generated controller home with an action show. > In the view show I have the text "sample text" > > I want to add a language swich

[Rails] Re: postgresql duplicate key violates unique constraint

2010-08-18 Thread Fernando Perez
Robby Russell wrote: > On Apr 29, 2006, at 5:56 PM, Guido Sohne wrote: > >> Throws an exception due to the following SQL error: duplicate key >> violates unique constraint. > > Your primary key index isn't in sync or something. > SELECT MAX(id) FROM entities; > > SELECT nextval('entities_id_

[Rails] Re: Student-course system

2010-08-18 Thread Quiliro
> 4) Edited the models/course.rb to >   has_many :studets, :through => :enrollments Check your spelling. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscr

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread Frederick Cheung
On Aug 18, 6:24 pm, IAmNan wrote: > Thanks, Fred. I think you've helped me out before. I appreciate your > effort. > > I've put the relevant code here:http://pastie.org/1100297 > > So you know what's happening, the farmer creates a Production, which > creates one or more Supplies, which may crea

[Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Me
oh you need to add the has_many for the join table has_many :meter_goup has_many :meters, :through => :meter_group On Aug 18, 2:41 pm, Rick R wrote: > On Wed, Aug 18, 2010 at 3:30 PM, Me wrote: > > I would start by getting rid of the :foreign_key  specifications > > unless you are doing somethi

[Rails] Re: module mixin issue

2010-08-18 Thread Frederick Cheung
> Error executing the script2: > > `const_missing': uninitialized constant AvailabilityReport::DataLoad > (NameError) You'll need to require the file defining that module yourself Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To

Re: [Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Rick R
On Wed, Aug 18, 2010 at 3:30 PM, Me wrote: > I would start by getting rid of the :foreign_key specifications > unless you are doing something non standard. > > Ok, thanks. I removed them. (Didn't fix the issue but does look a lot cleaner.) > On Aug 18, 2:26 pm, Rick R wrote: > > On Wed, Aug 1

[Rails] module mixin issue

2010-08-18 Thread Me
I am executing some scripts from the script directory. script files: -- script1: require File.dirname(__FILE__) + '/../config/boot' require File.dirname(__FILE__) + '/../config/environment' module DataLoad end - script 2 being executed: ---

[Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Me
I would start by getting rid of the :foreign_key specifications unless you are doing something non standard. On Aug 18, 2:26 pm, Rick R wrote: > On Wed, Aug 18, 2010 at 3:04 PM, Rick R wrote: > > I'm a rails newb and have been Googling about this, but I'm still stumped. > > > Not showing everyt

[Rails] Re: Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Rick R
On Wed, Aug 18, 2010 at 3:04 PM, Rick R wrote: > I'm a rails newb and have been Googling about this, but I'm still stumped. > > Not showing everything here, but basically it should be a pretty common > setup so I'm sure others know what I'm doing wrong. > > - A meter can belong to many meter_grou

[Rails] Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?

2010-08-18 Thread Rick R
I'm a rails newb and have been Googling about this, but I'm still stumped. Not showing everything here, but basically it should be a pretty common setup so I'm sure others know what I'm doing wrong. - A meter can belong to many meter_groups - A meter_group can have many meters. - A user can 'subs

[Rails] Locales

2010-08-18 Thread Jan Kadera
Hello, can sbdy please be so kind and tell me in a few words how to solve the following problem. I have just deployed an application. I generated controller home with an action show. In the view show I have the text "sample text" I want to add a language swich (better automatic recogniser) which

[Rails] Re: save! neither saves nor raises error

2010-08-18 Thread Fearless Fool
Jeffrey L. Taylor wrote: > Try 'obs[0].touch'. Quoting the documentation at > http://rails.rubyonrails.org/: Jeffrey: That's a great idea, but didn't work: irb(main):034:0> PremiseObservation.count => 0 irb(main):035:0> obs.touch => false irb(main):036:0> obs.save! => true irb(main):037:0> Prem

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread IAmNan
Thanks, Fred. I think you've helped me out before. I appreciate your effort. I've put the relevant code here: http://pastie.org/1100297 So you know what's happening, the farmer creates a Production, which creates one or more Supplies, which may create one or more Exchanges if there are any Demand

[Rails] Re: How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Marnen Laibow-Koser
Parker Selbert wrote: > Hussein B wrote: >> Hey, >> I have Rails 2.2.2 installed by default on Mac OS X 10.6 >> How to upgrade it to the latest Rails 2.x.x ? >> Thanks for help and time. > > You can update to the latest version of rails, but I would very highly > recommend install RVM (Ruby Versi

Re: [Rails] save! neither saves nor raises error

2010-08-18 Thread Jeffrey L. Taylor
Quoting Fearless Fool : > I don't like this. This makes me grumpy, and I've even already had my > morning coffee. > > obs[0] is a PremiseObservation, save! completed without error, yet > nothing was written to the db. This is a serious ass-biter: > > irb(main):057:0> PremiseObservation.count >

[Rails] Re: Re: Re: Re: rails named scopes joined with OR

2010-08-18 Thread Marnen Laibow-Koser
Colin Law wrote: [...] >> [...] >> I'd actually support a syntax for union queries such as >> Person.union_scope(:scope_a, :scope_b).  This makes it obvious that it >> is not a simple scope chain, while still being simple to call. > > Is that not what the OP was asking for in the original post to

[Rails] Re: How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Parker Selbert
Hussein B wrote: > Hey, > I have Rails 2.2.2 installed by default on Mac OS X 10.6 > How to upgrade it to the latest Rails 2.x.x ? > Thanks for help and time. You can update to the latest version of rails, but I would very highly recommend install RVM (Ruby Version Manager) as well. It will let y

[Rails] Re: How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Robert Walker
Hussein B wrote: > Hey, > I have Rails 2.2.2 installed by default on Mac OS X 10.6 > How to upgrade it to the latest Rails 2.x.x ? > Thanks for help and time. sudo gem update --system sudo gem install rails -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

Re: [Rails] How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Hassan Schroeder
On Wed, Aug 18, 2010 at 8:04 AM, Hussein B wrote: > I have Rails 2.2.2 installed by default on Mac OS X 10.6 > How to upgrade it to the latest Rails 2.x.x ? `sudo gem update rails` ought to do it :-) -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan --

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread Frederick Cheung
On Aug 18, 3:58 pm, IAmNan wrote: > I have a Production model, which represents a farmer's crop. After > create (via after_save) I call a method that creates one or more > Supply models, which represent a week of anticipated product harvest. > After each of those are created, a class method gets

[Rails] Re: When after_save isn't after the save....

2010-08-18 Thread IAmNan
FYI: I'm using rails 3.0.0.rc + ruby 1.8.7 + sqlite3 for dev, postgre for prod. On Aug 18, 10:58 am, IAmNan wrote: > I have a Production model, which represents a farmer's crop. After > create (via after_save) I call a method that creates one or more > Supply models, which represent a week of ant

Re: [Rails] Ruby 1.9 on Windows vs. Linux

2010-08-18 Thread Bruno Barros
Whats your rails version in windows and linux. Rails 3 : rails new app Rails 2: rails app 2010/8/18 Carl Jenkins : > I installed Ruby 1.9 on my Ubuntu laptop and started working on the > Depot application in the Agile Web Development with Rails book. > > After trying the same thing at work but,

[Rails] Re: How to use restful_authentication for nested resources in Ra

2010-08-18 Thread lucky in ruby
Marnen Laibow-Koser wrote: > lucky in ruby wrote: >> I have a nested resource hotel_user and i wish to have >> hotel_users_controller under hotel namespace. >> >> I want to use restful authentication here > [...] > > No you don't. restful_authentication should never be used: it relies > too mu

[Rails] Creating Rails/jQuery/DataMapper application

2010-08-18 Thread Hussein B
Hey, I want to create a Rails project that uses jQuery and DataMapper. Is it possible? If yes, would you please tell me how. Thanks all. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...

[Rails] How to upgrade Rails version that comes with OS X SL

2010-08-18 Thread Hussein B
Hey, I have Rails 2.2.2 installed by default on Mac OS X 10.6 How to upgrade it to the latest Rails 2.x.x ? Thanks for help and time. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@go

[Rails] When after_save isn't after the save....

2010-08-18 Thread IAmNan
I have a Production model, which represents a farmer's crop. After create (via after_save) I call a method that creates one or more Supply models, which represent a week of anticipated product harvest. After each of those are created, a class method gets called that tries to match each new Supply w

Re: [Rails] Re: error_messages_for doesn't work

2010-08-18 Thread Colin Law
On 18 August 2010 14:19, Bla ... wrote: > Yeah, I'm sorry. > > Actually, I wrote it wrong here, in the forum. > > It's: > > [code] >  <%= error_messages_for :hi, >                    :header_message => "Error." , >                    :message => "Check the following camps:"%> The docs at http://

[Rails] Re: Delete link in Rails 3

2010-08-18 Thread Bharat Ruparel
Please disregard. It turns out that I was using the wrong rails.js file with jQuery plus the wrong version of jQuery. Please watch the latest RailsCast from Ryan Bates to get around this problem. Thanks. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because yo

Re: [Rails] Re: Re: Re: rails named scopes joined with OR

2010-08-18 Thread Colin Law
On 18 August 2010 13:42, Marnen Laibow-Koser wrote: > Colin Law wrote: >> On 17 August 2010 23:02, Marnen Laibow-Koser >> wrote: >>> No. �Don't. �It's a bad idea. �It should never be necessary. �Did you >>> read the link I posted? >> >> Marnen, I am not sure what you are saying should never be ne

[Rails] Re: error_messages_for doesn't work

2010-08-18 Thread Bla ...
this tag "[code]" and "[/code]" is just to let everyone know where begins and where ends my code. It's not in my controller... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gro

[Rails] Re: How to use restful_authentication for nested resources in Ra

2010-08-18 Thread Robert Walker
Marnen Laibow-Koser wrote: > lucky in ruby wrote: >> I have a nested resource hotel_user and i wish to have >> hotel_users_controller under hotel namespace. >> >> I want to use restful authentication here > [...] > > No you don't. restful_authentication should never be used: it relies > too mu

[Rails] Re: How to use restful_authentication for nested resources in Ra

2010-08-18 Thread Marnen Laibow-Koser
lucky in ruby wrote: > I have a nested resource hotel_user and i wish to have > hotel_users_controller under hotel namespace. > > I want to use restful authentication here [...] No you don't. restful_authentication should never be used: it relies too much on unmaintainable generated code that

[Rails] Re: Ruby 1.9 on Windows vs. Linux

2010-08-18 Thread Carl Jenkins
UGH! I have Rials 2.3.8 not 3 ... :( my fault. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this g

[Rails] Ruby 1.9 on Windows vs. Linux

2010-08-18 Thread Carl Jenkins
I installed Ruby 1.9 on my Ubuntu laptop and started working on the Depot application in the Agile Web Development with Rails book. After trying the same thing at work but, on a Windows machine I notice something strange. When creating the depot applicaiton on Linux it is 'rails new depot' but, w

Re: [Rails] auth logic - password confirmation

2010-08-18 Thread Dave Aronson
On Tue, Aug 17, 2010 at 22:58, oliver torres wrote: > it works great in the video but for me i get this error > undefined method `password_confirmation' for # > > how come that password_confirmation method is not defined? > any tips? Most likely the method/data/whatever is not defined because th

[Rails] Re: error_messages_for doesn't work

2010-08-18 Thread Frederick Cheung
On Aug 18, 2:19 pm, "Bla ..." wrote: > Yeah, I'm sorry. > > Actually, I wrote it wrong here, in the forum. > > It's: > > [code] >  <%= error_messages_for :hi, >                     :header_message => "Error." , >                     :message => "Check the following camps:"%> > [/code] > What's

Re: [Rails] upgarde from rails 2.3.5 to rails 2.3.8

2010-08-18 Thread Niels Meersschaert
2.3.8 attempts to give deprecation notices for things which will go away in Rails 3.0 & later. In this case it is saying that several of your plugins should place their rake tasks into the lib directory. While this won't cause any problems in your app, it is good to start resolving the warning

[Rails] Re: rails3 console : how to get actual sql statements

2010-08-18 Thread Franco Sellitto
Here there is a tip: http://rubyquicktips.tumblr.com/post/29282/display-activerecord-generated-sql-queries-in-the In order to make it work for both Rails 2 and Rails 3, my ~/irbrc looks like: require 'logger' if ENV.include?('RAILS_ENV')&& !Object.const_defined?('RAILS_DEFAULT_LOGGER')

[Rails] Re: error_messages_for doesn't work

2010-08-18 Thread Bla ...
Yeah, I'm sorry. Actually, I wrote it wrong here, in the forum. It's: [code] <%= error_messages_for :hi, :header_message => "Error." , :message => "Check the following camps:"%> [/code] -- Posted via http://www.ruby-forum.com/. -- You received this me

[Rails] Re: undefined method `eq' for nil:NilClass

2010-08-18 Thread Abder-Rahman Ali
Thanks for your replies. The issue was as follows: As I mentioned, I'm walking through an example in "Head First Rails". I have used the book's version of "development.sqlite3" that contains some data. I used the name "advs" to create my application, and the table name in the database version

[Rails] Re: help needed to create a complex form

2010-08-18 Thread flyerhzm
Hi, There is an example for nested file upload form by using paperclip. The codes are similar to you, be attention to the usage of accepts_nested_attributes_for. Check it here: http://rails-bestpractices.com/posts/45-use-sti-and-polymorphic-model-for-multiple-uploads On Aug 18, 1:43 pm, Tom Mac

[Rails] Re: Re: Re: rails named scopes joined with OR

2010-08-18 Thread Marnen Laibow-Koser
Colin Law wrote: > On 17 August 2010 23:02, Marnen Laibow-Koser > wrote: >> No. �Don't. �It's a bad idea. �It should never be necessary. �Did you >> read the link I posted? > > Marnen, I am not sure what you are saying should never be necessary. > Suppose I have named_scope_a and named_scope_b.

[Rails] Re: undefined method `eq' for nil:NilClass

2010-08-18 Thread Tim Shaffer
What does your view look like? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroup

Re: [Rails] error_messages_for doesn't work

2010-08-18 Thread Colin Law
On 18 August 2010 13:02, Bla ... wrote: > I'm having a problem, 'cause I wrote the following line in my model > "Hi": > > [code] > validates_numericality_of :phone, :only_integer => true, :allow_blank => > false, :message => "must be a number" > [/code] > > And in my "new" view, I put: > > [code]

[Rails] error_messages_for doesn't work

2010-08-18 Thread Bla ...
I'm having a problem, 'cause I wrote the following line in my model "Hi": [code] validates_numericality_of :phone, :only_integer => true, :allow_blank => false, :message => "must be a number" [/code] And in my "new" view, I put: [code] <%= error_messages_for :oi, :header_mes

Re: [Rails] undefined method `eq' for nil:NilClass

2010-08-18 Thread Colin Law
On 18 August 2010 12:36, Abder-Rahman Ali wrote: > I'm walking through an example in the "Head First Rails" book, but, > instead doing the examples using Rails3.0.0.rc. > > But, I'm getting this error when browsing for example: > > http://localhost:3000/advs/1 > > undefined method `eq' for nil:Nil

[Rails] undefined method `eq' for nil:NilClass

2010-08-18 Thread Abder-Rahman Ali
I'm walking through an example in the "Head First Rails" book, but, instead doing the examples using Rails3.0.0.rc. But, I'm getting this error when browsing for example: http://localhost:3000/advs/1 undefined method `eq' for nil:NilClass Provided that my advs_controller.rb is as follows: http

[Rails] Re: Rails3: Arel finder discovery!

2010-08-18 Thread AppleII717
On Aug 18, 5:18 am, AppleII717 wrote: \> > I don't know if that was possible in rails2 (e.g., @bar > @foo.bars.find(:conditions => "xxx")) > > Not sure I have a use for it, but it was interesting that you can > filter a nested has_many relationship. I guess it was a learning experience for me.

[Rails] How to use restful_authentication for nested resources in Ra

2010-08-18 Thread lucky in ruby
I have a nested resource hotel_user and i wish to have hotel_users_controller under hotel namespace. I want to use restful authentication here and I want hotel_users_controller, sessions_controller in hotel directory like hotel/hotel_users_controller and hotel/sessions_controller. I tried with th

[Rails] Re: how to write an Ajax call w the new unobtrusive js ?

2010-08-18 Thread Erwin
the remote_function is still alive . I finally ended using it, and it works but the Rails 3 doc is not yet very clear about all this remote stuff On 18 août, 12:13, shahroon ali wrote: > Well, why not try observe_field? like this i did > > <%= check_box :campaign, :use_global, {}, 1,0 %>

[Rails] Re: Delete link in Rails 3

2010-08-18 Thread Bharat Ruparel
Hello Thani, I tried that, but no luck. The edit link that goes with delete link works fine. It is shown below: = link_to 'Edit', :controller => controller_name, :action => 'edit', :id => rec.id Corresponding routes.rb file snippet is shown below: ... resources :clients do member do

[Rails] Rails3: Arel finder discovery!

2010-08-18 Thread AppleII717
Rail3 Arel finders are just great, but you can't find a lot of example on how powerful they really are. I made a discovery, just experimenting with some chaining. List say you have Foo has may Bars @foo = Foo.find(1) @bar = @foo.bars That would give you all the bars related to foo(1) Bu

Re: [Rails] Re: how to write an Ajax call w the new unobtrusive js ?

2010-08-18 Thread shahroon ali
Well, why not try observe_field? like this i did <%= check_box :campaign, :use_global, {}, 1,0 %> <%= observe_field :campaign_use_global, :url => {:controller => "metakeys",:action => 'update_metakeys_flag', :id => parent_id, :type => "campaign"}, :with => "'val='+value", :method => :post %> Than

[Rails] upgarde from rails 2.3.5 to rails 2.3.8

2010-08-18 Thread Tom Mac
Hi I upgraded my rails application rails 2.3.8 from 2.3.5 like below gem install rails -v=2.3.8 Now in environemnt.rb RAILS_GEM_VERSION changed to '2.3.8'. Now when I tried to a previous migration like rake db:migrate VERSION=20100714122104 I got warning like DEPRECATION WARNING

Re: [Rails] rails named scopes joined with OR

2010-08-18 Thread Colin Law
On 18 August 2010 09:15, Sandip Ransing wrote: Please don't top post, it makes it difficult to follow the thread. > Franz, > what you said i was doing this but it's not good performance wise as it > fires 2 queries also > purpose of pagination will be for toss bcoz it will load objects and then

[Rails] Re: how to write an Ajax call w the new unobtrusive js ?

2010-08-18 Thread AppleII717
The rails.js UJS file appears to handle only links/anchors or forms. I went through a "I want to do this with UJS" about a week ago. While I got it to work, I am not sure what I accomplished since I was not doing AJAX - I just wanted to replace a non-working client-side Javascript validation routi

[Rails] [prototype] Element.readAttribute in js.rjs

2010-08-18 Thread Erwin
I am trying to test the 'type' attribute' of some elements in my page , but I don't get it right, writing the following code in my .rj.rjs file page.select('#user-list input').each do |e| t = e.readAttribute('type') page.alert(t) end just displays : [object HTMLInputElement] I'm wrong , su

[Rails] Re: [Rails 3] remote_function ?

2010-08-18 Thread Erwin
Thanks Greg I've already look at it. My issue was related to the remote_function which seems to be still available... All that stuff in Rails 3 is not yet so clear for me... I am using this on a checkbox tag, not on a tag (which is well documented in the doc) = check_box_tag("selection", "1",

  1   2   >