Re: [Rails] How to paginate in the same view?

2010-10-22 Thread Anthony Crumley
If you provide the :param_name option to the will_paginate helper method then you can page the two separately by providing separate page params. If you do this, you will need to maintain the previous page number in a session variable or cookie so you don't loose the page on the other list. You ma

Re: [Rails] Re: Clearing a plugins instance variables on each request

2010-04-12 Thread Anthony Crumley
Sean, I think flash.now would be fine for objects because it is only there during the request and is not persisted. Anthony Crumley http://commonthread.com On Mon, Apr 12, 2010 at 9:21 PM, SeanWalberg wrote: > It would seem to do what I'm looking for, though was the flash meant >

Re: [Rails] How to check if a parent has children?

2010-04-12 Thread Anthony Crumley
Paul, Sorry, but I gave you the wrong method. It should have been ... unless @client.line_items.empty? Anthony Crumley http://commonthread.com On Mon, Apr 12, 2010 at 9:10 PM, Paul Jonathan Thompson wrote: > Thanks Anthony, > > It's better, but I'm not quite there ye

Re: [Rails] How to check if a parent has children?

2010-04-12 Thread Anthony Crumley
Paul, if @client.line_items.exists? Anthony Crumley http://commonthread.com On Mon, Apr 12, 2010 at 8:30 PM, Paul Jonathan Thompson wrote: > What is the new way to check if a parent has child items? In rails > 1.2.6 I did this: > > if @client.has_line_items? > > Client be

Re: [Rails] Re: Customized Route Resource Helper URLs (to not use 'id')

2010-04-12 Thread Anthony Crumley
Seth, This article may be helpful. http://www.viget.com/extend/pain-free-pretty-urls-in-rails/ Anthony Crumley http://commonthread.com On Mon, Apr 12, 2010 at 6:25 PM, Seth Willits wrote: > > Change what exactly? The resources method does not have options to > customize the behavi

Re: [Rails] SQL/Paginate help needed for has_many :through relationship

2010-04-12 Thread Anthony Crumley
Max, How about something like... :order=>"(CASE WHEN tags.name = 'piano' THEN 1 ELSE 0 END) desc, tags.name", Anthony Crumley http://commonthread.com On Mon, Apr 12, 2010 at 10:02 AM, Max Williams wrote: > Hey all. I'm doing a paginated find with will_pagina

Re: [Rails] Rails NEW and ADVANCED

2010-04-12 Thread Anthony Crumley
http://railscasts.com/ On Mon, Apr 12, 2010 at 6:40 AM, Newb Newb wrote: > Hello All, > i would like to know what are rails new and advanced concepts that i can > learn and try with... > > Pls provide me any link or suggestions > > Thanks for your info... > -- > Posted via http://www.ruby-forum

Re: [Rails] Clearing a plugins instance variables on each request

2010-04-12 Thread Anthony Crumley
Sean, Would flash.now work? http://apidock.com/rails/ActionController/Flash/FlashHash/now Anthony Crumley http://commonthread.com On Sun, Apr 11, 2010 at 11:11 PM, SeanWalberg wrote: > I'm trying to move some of my application's code into a plugin, > specifically the part tha

Re: [Rails] complete validation failures

2010-04-12 Thread Anthony Crumley
badnaam, The following should have f.select. <%= select_tag :level, options_for_select([["Base", 1], ["Silver", 2], ["Gold", 3]]) %> On Sun, Apr 11, 2010 at 4:41 PM, badnaam wrote: > All the validations fail, even though the values in the params[] are > valid. Here is the error in the logs, t

Re: [Rails] Administration

2010-04-12 Thread Anthony Crumley
ently for admin users. Also, some information or functionality in the views will only be available to admins. Sometimes admins need views that show information from a broad set of entities in the system. In this case, I would create an admin controller to handle those views. Anthony Crumley

Re: [Rails] simple role system through associative table

2010-04-12 Thread Anthony Crumley
lot ninja pilot_ninja = ... # Create co-pilot ninja copilot_ninja = ... # Associate ninjas to hovercrafts hovercraft.piloted.create(:ninja => pilot_ninja) hovercraft.copiloted.create(:ninja => copilot_ninja) Anthony Crumley http://commonthread.com On Sun, Apr 11, 2010 at 5:01 AM, Daniel Dreh

Re: [Rails] Re: Don't Automatically start SESSION?

2010-04-11 Thread Anthony Crumley
David, If you still need some help with this then please provide the user controller code. Anthony Crumley http://commonthread.com On Sat, Apr 10, 2010 at 12:42 PM, David Zhu wrote: > i really need help. anyone got a solution? > > On Apr 10, 8:51 am, David Zhu wrote: > > how

Re: [Rails] Re: test database and migrations

2010-04-11 Thread Anthony Crumley
th my constants or the > way I'm handling them, e.g., zip codes. Anyway, this concern straddles > the line between uncertainty about inputs, e.g., app constant data > like zip codes, and outputs -- what an app does with them. > > Thanks for your comments, I consider my question w

Re: [Rails] test database and migrations

2010-04-11 Thread Anthony Crumley
. A more conventional approach would be to create fixtures with the test data. Then you can load those fixtures into your development database with "rake db:fixtures:load". Anthony Crumley http://commonthread.com On Sat, Apr 10, 2010 at 8:59 AM, Grary wrote: > Hi, > > I

Re: [Rails] Moving to Widgets from Standard Rails UI

2010-04-10 Thread Anthony Crumley
application because there was just too much pain. Anthony Crumley http://commonthread.com On Fri, Apr 9, 2010 at 7:54 PM, Smart RoR wrote: > Hi: > > I am planning to move my app from Standard Rails UI with form_for to > using widgets from jQuery/ExtJS... > > Most of these take

Re: [Rails] Re: Rendering a Partial as an Alternative

2010-04-10 Thread Anthony Crumley
syntax for this is <% rescue ActionView::MissingTemplate %>. Anthony Crumley http://commonthread.com On Sat, Apr 10, 2010 at 4:05 AM, Rahul Mehta wrote: > Hi Anthony, > > <% begin %> > <%= render :partial => 'custom' %> > <% rescue ActionView::

Re: [Rails] gem install rails (Errno::ENOENT) No such file or directory

2010-04-09 Thread Anthony Crumley
Jesús, Have you tried installing ruby into a directory path that does not have any spaces in it? Anthony Crumley http://commonthread.com On Fri, Apr 9, 2010 at 3:48 PM, Jesús Dugarte wrote: > I have two PCs, one with Windows XP and another with Windows Vista. I'm > working as an ad

Re: [Rails] Rendering a Partial as an Alternative

2010-04-09 Thread Anthony Crumley
Doug, This may actually be worse but it is another way... <% begin %> <%= render :partial => 'custom' %> <% rescue ActionView::MissingTemplate %> Default <% end %> Anthony Crumley http://commonthread.com On Fri, Apr 9, 2010 at 7:29 PM, doug wrote:

Re: [Rails] Declaring arrays shared across different controller methods

2010-04-09 Thread Anthony Crumley
ntain them between requests. 4) Use some sort of cache like memcached. I hope this helps. Anthony Crumley http://commonthread.com On Fri, Apr 9, 2010 at 3:45 AM, ES wrote: > I would like to have an array saving fields to display for an object > that is used for its form on multiple pages. >

Re: [Rails] Image retrieve

2010-04-09 Thread Anthony Crumley
Buvan, This article may be helpful... http://www.therailsway.com/2009/2/22/file-downloads-done-right <http://www.therailsway.com/2009/2/22/file-downloads-done-right>Anthony Crumley http://commonthread.com On Thu, Apr 8, 2010 at 11:26 PM, Priya Buvan wrote: > Hi All, > >

Re: [Rails] Re: time_select and MultiparameterAssignmentErrors

2010-04-08 Thread Anthony Crumley
Kendall, This link will take you to an page with some information on how to create a bug report as well. https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview <https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview>Anthony Crumley http://commonthread.com

Re: [Rails] Pick up change to plain ol' Ruby file?

2010-04-08 Thread Anthony Crumley
Chris, It should pick it up from the lib folder. Although, it seems some older versions of rails did not. Anthony http://commonthread.com On Thu, Apr 8, 2010 at 12:04 PM, Chris Morris wrote: > I have a .rb file without any controllers, models, etc. in it - in dev mode > my instance picks up n

Re: [Rails] Rails/JQuery Collection Select

2010-04-08 Thread Anthony Crumley
Joshua, Also consider using link_to_remote with the :update and :position options. Then you can keep all the view code on the server. Anthony Crumley On Thu, Apr 8, 2010 at 10:59 AM, Anthony Crumley wrote: > Joshua, > > BTW...I forgot to mention there is a to_json method you can pro

Re: [Rails] Rails/JQuery Collection Select

2010-04-08 Thread Anthony Crumley
Joshua, BTW...I forgot to mention there is a to_json method you can probably use to convert the @phone_number_categories collection to a Javascript value. Anthony Crumley On Thu, Apr 8, 2010 at 10:57 AM, Anthony Crumley wrote: > Joshua, > > You can't access that variable direct

Re: [Rails] Rails/JQuery Collection Select

2010-04-08 Thread Anthony Crumley
scope with the jQuery code. You can store them in an array or JSON object or an array of JSON objects or what ever makes the most sense. Anthony Crumley On Thu, Apr 8, 2010 at 10:45 AM, Joshua Martin wrote: > I may be asking a very dumb question, but I thought it'd be worth the > asking

rubyonrails-talk@googlegroups.com

2010-04-08 Thread Anthony Crumley
Christophe, The "&:new_record?" is a Rails idiom. In this example it is a shortcut for... tasks.reject{|t| t.new_record?}.each do |task| Anthony Crumley On Thu, Apr 8, 2010 at 10:08 AM, Christophe Decaux < christophe.dec...@gmail.com> wrote: > Hi there, > >