[Rails] Re: Help with return_back

2009-02-14 Thread Chris Kottom
Based on the principle of least surprise, you've got two cases you need to plan for: 1. The user explicitly requests the login page, and so after a successful login, you send him back to the page he came from. 2. The user requests a protected action that requires login, so you

[Rails] Re: Auto_complete plugin in Rails 2.2.2 (auto_complete_for method not found)

2009-02-14 Thread Spiros K.
Thanks for your reply, but 1. this specific plugin did not have an install.rb with it. 2. 2.2.2 is as new as they get I just downloaded 3 weels ago...?! And i think it works just fine with git as I have downloaded from git as well (though it messed my tortoise svn structure pretty badly) Then

[Rails] Re: Odd js behavior in Chrome Safari

2009-02-14 Thread chauzer
I ran into this same issue, it has nothing to do with Rails. This looks to be an issue with the way WebKit (used by Safari and Chrome) handles javascript and form submits. Looks like if there is a onclick on a submit button, data from the form is not submitted when the page is posted. On Dec

[Rails] Undefined method 'parameters' on controller.request

2009-02-14 Thread Michael J. I. Jackson
I'm getting a NoMethodError using Rails 2.1.0 when trying to send an email using ActionMailer. The error is being thrown from the template_format method in ActionView's base.rb file. Apparently the controller.request object is an instance of DummyClass (according to the exception trace)

[Rails] Re: How to stop validating after a failed validation?

2009-02-14 Thread Frederick Cheung
On Feb 13, 11:29 pm, ericindc ericmilf...@gmail.com wrote: I want my first check to verify email address uniqueness.  If this validation fails, there's no reason to go further with validating the user's input.  I want a singular message displayed in this case.  Is there a way to do this? I

[Rails] Re: params

2009-02-14 Thread Frederick Cheung
On Feb 14, 6:36 am, Vetrivel Vetrivel rails-mailing-l...@andreas- s.net wrote: How to convert params variable as hash.I am not able to convert params as a hash. If you are talking about the params variable you get in your controller actions, it's already a hash. Perhaps you can clarify what

[Rails] Re: association include and joins issues - 'Unknown Column' error

2009-02-14 Thread Frederick Cheung
On Feb 14, 12:43 am, Chris csw11...@gmail.com wrote: Hi all, I'd really appreciate any help / advice on this problem. When I test this   def edit     @entity = Entity.find(params[:id],                           :include = :key_factors)     @traits = Trait.find :all,                    

[Rails] Re: Eager fetching returning JSON results

2009-02-14 Thread Frederick Cheung
On Feb 14, 1:26 am, Joshua Partogi joshua.j...@gmail.com wrote: All, I have a many_to_one relationship object between products and categories and I want to return the category too using JSON results but it seems that rails only gives back the products JSON object on the view layer. This

[Rails] Re: Observe Field Problem

2009-02-14 Thread Frederick Cheung
On Feb 13, 11:39 pm, Enzo Rivello rails-mailing-l...@andreas-s.net wrote: Hi there! I need to use observe field to change dynamically one select field based on another select field: here is the view: %= observe_field 'class', :url = { :action = 'update_list' },           :frequency =

[Rails] Re: Auto_complete plugin in Rails 2.2.2 (auto_complete_for method not found)

2009-02-14 Thread Frederick Cheung
On Feb 14, 9:58 am, Spiros K. spiros...@gmail.com wrote: Thanks for your reply, but 1. this specific plugin did not have an install.rb with it. 2. 2.2.2 is as new as they get I just downloaded 3 weels ago...?! And i think it works just fine with git as I have downloaded from git as well

[Rails] Re: Logging all exceptions

2009-02-14 Thread koopmann.lenn...@googlemail.com
On 14 Feb., 03:56, Robby Russell ro...@planetargon.com wrote: You might consider using Exceptional for this. *http://getexceptional.com/ Thank you, Robby. The problem is that I want to build the database exception logging into the Rails web interface of a free software project.

[Rails] Re: How can I retrieve the SQL during each model action?

2009-02-14 Thread Mark Reginald James
xeon wrote: Hi, I would like to know for each running model action, how can I retrieve the SQL running behind? I don't want to scan log each time for the sql running behind. E.g. post.find(:all,:conditions={:id='1'} I wanna debug the sql generated behind, is that other shorthand

[Rails] Re: Redirect_to Vs Render_component

2009-02-14 Thread Mark Reginald James
Srividya Sharma wrote: Hello I am using Rails 2.2.2. Here is my problem: I have a controller action which will receive several parameters, validate them, process them and create a new set of parameters out of them. Then, this controller should delegate the task to another controller

[Rails] Re: NoMethodError in User_photos#show

2009-02-14 Thread Frederick Cheung
On Feb 14, 3:32 am, Ken Lim rails-mailing-l...@andreas-s.net wrote: MaD wrote: well, the error-message is pretty clear: The error occurred while evaluating nil.user 2: %= link_to #...@photo.user.username}'s Photos, @photo seems to be nil. the reason for it can be found in your

[Rails] Re: Redirect_to Vs Render_component

2009-02-14 Thread Srividya Sharma
Nice to see a response. The other method is in another controller. And the other method needs to use send_data. (basically write a response) So I cannot use a simple class, include that class in the first controller. since the other method has to write out a response, it needs to be in another

[Rails] can this be done without using find_by_sql

2009-02-14 Thread tonypm
Hi, I am increasingly needing to do some more complex finds involving several table associations. I can usually find an SQL solution, but find it hard to think these out using ActiveRecord find techniques. I guess I am thinking in SQL terms, when perhaps there is a way of thinking in

[Rails] Re: Suggestions for a rails webhost...

2009-02-14 Thread tonypm
Peter, The dramatic improvement in ping time does make quite a difference to be honest, Confirms what I was what I was wondering about. Had a look at bytemark, they look worth following up. Thanks Tonypm --~--~-~--~~~---~--~~ You received this message

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread Frederick Cheung
On 14 Feb 2009, at 11:33, tonypm wrote: Hi, I am increasingly needing to do some more complex finds involving several table associations. I can usually find an SQL solution, but find it hard to think these out using ActiveRecord find techniques. I guess I am thinking in SQL terms, when

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread Phlip
tonypm wrote: Repair has_many :notes SELECT * FROM repairs where exists (select * from notes where repairs.id=notes.repair_id and and notes.flagged) r = Repair.find(...) notes = r.notes.find_by_flagged(true) I can't think of a way to learn how deep the ActiveRecord DSL

[Rails] Re: NoMethodError in User_photos#show

2009-02-14 Thread MaD
two suggestions: 1. set a debugger at the beginning of you show-method. that way you will find the reason for @photo being nil. 2. since Photo.id is your primary key (and therefore unique) you could just do your find like this: @photo = Photo.find(params[:id]) instead of the much longer:

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread Phlip
Frederick Cheung wrote: Repair has_many :notes SELECT * FROM repairs where exists (select * from notes where repairs.id=notes.repair_id and and notes.flagged) I forgot my basic SQL! I think that's just SELECT * FROM repairs r, notes n WHERE r.id = n.repair_id AND

[Rails] Re: Eager fetching returning JSON results

2009-02-14 Thread Joshua Partogi
Darn, I returned an array object besides that products instance, giving that to_json will give backslashes to the quotes. On Feb 14, 9:31 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 14, 1:26 am, Joshua Partogi joshua.j...@gmail.com wrote: All, I have a many_to_one

[Rails] Re: How to stop validating after a failed validation?

2009-02-14 Thread ericindc
Thanks for the response. I'm still not sure how I'll approach this. I'm going to spend a bit of time tinkering with the :if option, as well as creating my own validation function. I agree that it is annoying for the user to have to correct errors one at a time. But I'd imagine correcting a

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread tonypm
Just to finish the story. Sorry - the distinct in the select is needed, I missed it out. Going a step further, I now have: named_scope :flagged_repairs, :select = 'distinct repairs.*', :joins = :repair_notes, :conditions = [notes.flagged = ?, true] So in my search, where I am building a

[Rails] Re: attachment_fu problems with image_science

2009-02-14 Thread Tod Mcintyre
Richard Schneeman wrote: Danimal wrote: Richard, I am having exactly the same problem. Everything works on my macbook pro. But on my deployment server I get the same error. I'm still looking. Hopefully I can find a solution. Like you, I'm having trouble with RMagick. Plus I like

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread tonypm
Fred, Repair.find :all, :select = 'distinct repairs.*', :joins = :notes, :conditions = [flagged = ?, true] nice - many thanks. just needed to fix notes.flagged -- In reality I have a generic notes model, so my usage is slightly more complex: In Repair I

[Rails] about validate

2009-02-14 Thread Mike75
hello.. I am new to Ruby on Rails.. (2.2) I am currently following steps from the book agile web delopment with Rails building depot application. It says I need to edit app/models/product.rb file and add the following lines to check the price to be at least a cent.. that's 0.01 def

[Rails] Re: BackgroundRB persistant job table not created

2009-02-14 Thread Ratnavel P S
I use rails 2.2.2 Backgroundrb version (latest from svn) -- 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

[Rails] Re: about validate

2009-02-14 Thread MaD
i just tried it for myself. it's working correctly. so i advice to put a debugger at the beginning of your action and look what you are getting for price and where the error occurrs (whether it's inside that method or even before). --~--~-~--~~~---~--~~ You

[Rails] BackgroundRB persistant job table not created

2009-02-14 Thread Ratnavel P S
Hi, I have used backgroundrb plugin in my application, I followed the tutorial in, http://backgroundrb.rubyforge.org/ Everything works fine, When I run rake backgroundrb:setup, It created the required scripts, and backgroundrb.yml but the mirgation files were missing. Can some one help me out

[Rails] Hook Exist in Rails for System-Wide Exception Logging?

2009-02-14 Thread Peter Alvin
On our production servers, I'd like all exceptions to be automatically logged to the database. In other C# project I wrote that meant putting a try/catch in every entry point method with the catch calling a generic routine which did the INSERT into exceptions... SQL statement. How do I do this

[Rails] Re: Schedule job in rails

2009-02-14 Thread Randy Kramer
On Saturday 14 February 2009 12:52 am, Valentino Lun wrote: Is it possible to do this in my crontab as follow? 10 10 * * * wget http://localhost:3000/cron/someaction para1 para2 I'm not sure, but an alternative is to put the wget command in a small shell script (Linux talk, iiuc) or a .bat

[Rails] Re: AR_Mailer Problem

2009-02-14 Thread Borja Martín
which ruby version are you using? I think I had a similar problem using ruby 1.8.7 and solving it by downgrading to 1.8.6... On Fri, Feb 13, 2009 at 5:23 PM, Sean McGilvray smcgilv...@gmail.com wrote: Hi all, I am using ar_mailer for sending newsletter. I got mails queued in emails table.

[Rails] Re: Undefined method 'parameters' on controller.request

2009-02-14 Thread Julian Leviston
Actionmailer is a bit different because the mail has it's own view which has no controller. You'd have to pass the controller in through the message to the mail when you're delivering or building it. Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 14/02/2009, at

[Rails] serialize ... what am I doing wrong?

2009-02-14 Thread phil
Hi. I want to serialize out an object to the database. But I am getting an integer value in the column when I expect to see some yaml! migration: class CreateSummaries ActiveRecord::Migration def self.up create_table :summaries do |t| t.text :summary_data t.timestamps end

[Rails] Re: Auto_complete plugin in Rails 2.2.2 (auto_complete_for method not found)

2009-02-14 Thread Spiros K.
Yes, the plugin IS in vendor plugins and YES you can check my first post in the thread and see that my 2nd post was actually a typo in my behalf. The problem remains as stated. BTW, the code was copy-pasted from tutorials that supposedly work, so I doubt there is any weird typo in the actual

[Rails] Re: how can I secure rails script?

2009-02-14 Thread Lukey Portiski
Bpx Bpx wrote: Hello, I was searching for some way to secure my rails scripts. Do anybody know what can I use? I found Rencoder (www.rencoder.com) on the net but I want to know if there are others programs I can use? Well, definitely don't use this Rencoder. Its not secure and frankly it

[Rails] Re: Schedule job in rails

2009-02-14 Thread Harold A . Giménez Ch .
No quite like that. If you're sending an HTTP GET request to any URL, you would pass parameters to the URL itself, something like: http://localhost:3000/cron?param1=value1param2=value2 etc What looks attractive to me about this approach (of using wget via cron instead of a rake task) is that you

[Rails] Re: Auto_complete plugin in Rails 2.2.2 (auto_complete_for method not found)

2009-02-14 Thread Frederick Cheung
On Feb 14, 3:52 pm, Spiros K. spiros...@gmail.com wrote: Yes, the plugin IS in vendor plugins and YES you can check my first post in the thread and see that my 2nd post was actually a typo in my behalf. The problem remains as stated. odd. i'd stick a breakpoint in the plugin's init.rb to

[Rails] SUCCESS!! BUG?? Re: 2 button_to functions for file downloads

2009-02-14 Thread Me
OK Well this must be a bug I guess but I managed to get it to work. For some reason the first one was trying to give the js response to the action. So for the hey of it I used 3 button_to's and the bottom two worked while the first one was giving me the same response. div style=display:

[Rails] Re: SUCCESS!! BUG?? Re: 2 button_to functions for file downloads

2009-02-14 Thread Frederick Cheung
On Feb 14, 5:54 pm, Me chabg...@gmail.com wrote: OK Well this must be a bug I guess but I managed to get it to work. button_to generates a form for you with a button. You've put a button in a form, therefore in the generated html there will be a form nested inside a form which isn't valid

[Rails] Re: restful_authentication with rails 2.2

2009-02-14 Thread Sandeep Sagar
I have recently setup restful_auth.. on 2.2.2 and all the unit tests passed except for a little correction in the users.yml (fixture) I have been able to successfully create and activate users. I did setup with acts_as_state_machine (AASM) too. Some things I would check- Did the migration

[Rails] What is the difference between build and new

2009-02-14 Thread John Smith
I use new in almost all my controllers, but sometimes I have seen the build method inside the controllers of some apps. Can someone explain when should I use build? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: What is the difference between build and new

2009-02-14 Thread Phlip
John Smith wrote: I use new in almost all my controllers, but sometimes I have seen the build method inside the controllers of some apps. Can someone explain when should I use build? .build fixes the fact you cannot say this: my_post.tags.new(:name = 'reggae') The new() operator is

[Rails] Re: can't find gems in /vendor/gems/ after modifying load_paths

2009-02-14 Thread Matt Jones
On Feb 13, 11:42 am, Sarah Allen rails-mailing-l...@andreas-s.net wrote: I'm picking up a Rails app that is using a lot of older gems.  We're using Rails 2.0.2 and planning to move to to Rails 2.3 along with upgrading the the dependencies.  However, in the meantime, we're moving servers

[Rails] Re: serialize ... what am I doing wrong?

2009-02-14 Thread Rick
Summary.new is expecting to receive a hash, which isn't what you're giving it. i.e.: summary = Summary.new( :summary_data = { name=Administator, login=admin } ) summary.save! Summary.last.summary_data = {name=Administrator, login=admin} On Feb 14, 5:29 am, phil p...@philsmy.com wrote: Hi. I

[Rails] Re: What is the difference between build and new

2009-02-14 Thread Rob Biedenharn
On Feb 14, 2009, at 2:37 PM, Phlip wrote: John Smith wrote: I use new in almost all my controllers, but sometimes I have seen the build method inside the controllers of some apps. Can someone explain when should I use build? .build fixes the fact you cannot say this:

[Rails] Re: reaper is not picking up new changes to my application???

2009-02-14 Thread Greg Hauptmann
(bump) still really keen if someone has any info on this one (see below) 2009/2/10 Greg Hauptmann greg.hauptmann.r...@gmail.com Still stuck on this. I made sure I wasn't in the current directory when I did the call to reaper and I still get the same result, i.e. whilst the process restarts

[Rails] Re: can't find gems in /vendor/gems/ after modifying load_paths

2009-02-14 Thread Sarah Allen
Matt Jones wrote: Take a careful look at the errtheblog article - you should be using require, not gem here. The gem statements only add the gem directories to the load_path. Changing to 'require' got past that error. I still don't understand why it failed to load since I had requires

[Rails] Re: cPanel Ruby Gems

2009-02-14 Thread Matt Jones
On Feb 13, 9:49 am, Rob Pa rails-mailing-l...@andreas-s.net wrote: Michael Mike wrote: Did you find a solution to this? I am experiencing the same problem. I contacted my host and got them to update my Ruby Gems. However I now get this message; :0:Warning: Gem::SourceIndex#search

[Rails] Two-to-one mappings

2009-02-14 Thread Greg Brockman
Hey all, I have a pretty simple question, but I'm not sure of a good solution to it. Essentially, I want to provide a two-to-one mapping of models. I'm working on an application for a contest, where every (unordered) combination of two Rounds is supposed to be assigned to one Room. Any Room

[Rails] Re: What is the difference between build and new

2009-02-14 Thread DarkTatka
build does not save the object. create does. if saving fails, create returns false, create! raises error (useful in migration, will rollback) On 14 Ún, 20:37, Phlip phlip2...@gmail.com wrote: John Smith wrote: I use new in almost all my controllers, but sometimes I have seen the build

[Rails] Re: can this be done without using find_by_sql

2009-02-14 Thread DarkTatka
named scope is definitely the way to go. check out http://guides.rubyonrails.org/active_record_querying.html#_named_scopes for more options (especialy named scope with argument) On 14 Ún, 13:32, tonypm tonypmar...@hotmail.com wrote: Just to finish the story. Sorry -  the distinct in the

[Rails] Re: gem cleanup and rails 1.2.6 problem

2009-02-14 Thread Charles Johnson
The problem is with your path. You want /System/Library... but you are doing -/System/Library... See the difference? Cheers-- Charles On Fri, Feb 13, 2009 at 3:35 PM, elle wazne...@gmail.com wrote: gem list -d rails gives me: *** LOCAL GEMS *** rails (2.2.2, 1.2.6) Author: David

[Rails] Re: association include and joins issues - 'Unknown Column' error

2009-02-14 Thread Chris Warren
Excellent! Thanks for the clarification, Fred! I think adding the trait_values as an inner join will do the trick. -Chris On Sat, Feb 14, 2009 at 5:26 AM, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 14, 12:43 am, Chris csw11...@gmail.com wrote: Hi all, I'd really

[Rails] Trying the ol' articles route, need some help

2009-02-14 Thread yaphi
Hey there, I am trying to figure out routing and thought that this would probably be the best way to learn how to do some complicated routes. I've looked at a lot of people's methods for getting the /articles/ 2009/02/12/some-title to work but they all seem to forget to post some custom method

[Rails] Execute cap deploy:migrations fails

2009-02-14 Thread olivierntk
Hi there, I am trying to deploy a rails app on dreamhost. Here is the error message that I get: fatal: 'home/USER_NAME/DOMAIN_NAME/git/APPLICATION_NAME.git': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly

[Rails] Re: Execute cap deploy:migrations fails

2009-02-14 Thread Maurício Linhares
Try to remove the set :deploy_via, :remote_cache, could never get it to work. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, Feb 14, 2009 at 10:51 PM, olivierntk olivier...@gmail.com wrote: Hi there, I am trying to deploy a rails app

[Rails] Re: Execute cap deploy:migrations fails

2009-02-14 Thread Freddy Andersen
Looking at the print from capistrano: fatal: 'home/USER_NAME/DOMAIN_NAME/git/APPLICATION_NAME.git': unable ??? That just does not look right. From the host where you have capistrano are you able to run git clone and the git url ? Here is a git example url set :repository,

[Rails] Re: I get “Missing these required gems”, but gems are installed

2009-02-14 Thread Freddy Andersen
Gems might be installed in more than one area. Look in ~/.gems and make sure that you use sudo when installing gems. Do you now have multiple ruby directories on your mac? if so you most likely have multiple gems directories too... what I found was best when I upgraded from 1.8.6 to 1.8.7 was

[Rails] Re: Two-to-one mappings

2009-02-14 Thread Maurício Linhares
Imagining that every round must belong to a room, here's a simple and straightforward implementation: class Room ActiveRecord::Base # this class needs a max_rounds and rounds_count integer columns has_many :rounds def accepts_more_rounds? max_rounds rounds_count end end class

[Rails] Re: Two-to-one mappings

2009-02-14 Thread Harold
That's a clean solution, however I don't know if it satisfies the fact that any Room might have many different combinations of Rounds Not sure I understand correctly, but if a room can have many combination of rounds, and each combination of rounds has more than one round, you could try this:

[Rails] conditions on association include, hacky but more or less solved

2009-02-14 Thread Chris
Hi all, I just finally figured out how to get 2.2.2 to do this, and thought I'd share in case others run into the same thing. The situation is a find with associations, but the tricky part is that the association shouldn't always be loaded. This is similar to putting a condition on a has_many

[Rails] Re: Undefined method 'parameters' on controller.request

2009-02-14 Thread Michael J. I. Jackson
How do I pass the controller through so that a method like template_format will pick it up and use it? Or is there some way to avoid that method being called altogether? Thanks, Michael On Feb 14, 2009, at 8:27 AM, Julian Leviston wrote: Actionmailer is a bit different because the mail

[Rails] inserting a form on a page when button pressed

2009-02-14 Thread Adam Akhtar
Ive googled this and searched here and other forums but not getting appropriate reuslts. Perhaps someone on the board can help. All i want to do is to have a button/link on a page such as add task which when pressed will insert the appropriate form plus fields directly under the button/link. Im

[Rails] Re: Two-to-one mappings

2009-02-14 Thread Greg
Cool! Harold, your solution strikes me as being exactly the way to do it. I've implemented it, and things seem to be sailing smoothly. Thanks a lot to both of you. Sincerely, Greg On Feb 14, 11:47 pm, Harold harold.gime...@gmail.com wrote: That's a clean solution, however I don't know if it

[Rails] Re: Two-to-one mappings

2009-02-14 Thread Harold A . Giménez Ch .
Great! Glad it worked. On Sun, Feb 15, 2009 at 1:57 AM, Greg gregory.brock...@gmail.com wrote: Cool! Harold, your solution strikes me as being exactly the way to do it. I've implemented it, and things seem to be sailing smoothly. Thanks a lot to both of you. Sincerely, Greg On Feb