Re: [Rails] which views are rendered for an URL

2010-04-19 Thread Ryan Waldron
On Mon, Apr 19, 2010 at 9:13 AM, Marcelo Barbudas wrote: > Hi, > > Is there a way I can figure out which files are run for a specific > URL? > > Given http://www.planet.com/countries files like: countries/ > index.html.erb, countries/_country.html.erb, layouts/ > application.html.erb and so on. >

Re: [Rails] Re: Will rake db:migrate:down VERSION=XXX completely remove that migration from Rails?

2010-04-08 Thread Ryan Waldron
actually correct one. :) > On Apr 6, 11:53 pm, Ryan Waldron wrote: >> It is in whatever database your app is using.  Rails creates and >> maintains it for you.  So if your production database is 'foo_prod', >> there would be a 'schema_migrations' table ther

Re: [Rails] Re: Will rake db:migrate:down VERSION=XXX completely remove that migration from Rails?

2010-04-06 Thread Ryan Waldron
y to remove that row without firing up your database itself (MySQL or whatever). On Tue, Apr 6, 2010 at 10:43 PM, GoodGets wrote: > Thanks Ryan > > and, I hope this isn't too stupid of a question, but where is this > 'schema_migrations' table? > > On Apr

Re: [Rails] A Confirmation System?

2010-04-06 Thread Ryan Waldron
David, I don't know if this would help you, but you might poke around in http://github.com/subwindow/needs_approval for some ideas. I've not used it, so I don't know how mature it is. On Tue, Apr 6, 2010 at 5:08 PM, David Zhu wrote: > Hey, > > I'm not sure how complex this really is, but i hope

Re: [Rails] unknown attribute: version (nested forms)

2010-04-06 Thread Ryan Waldron
Where's the error message? On Tue, Apr 6, 2010 at 8:49 PM, oren wrote: > I try to update a nested model (version) and get this error.  any tips > would be great! > > my models: location has_many :versions > > # view > >  <% form_for location do |location_form| %> >     >      <%= location_form.la

Re: [Rails] Will rake db:migrate:down VERSION=XXX completely remove that migration from Rails?

2010-04-06 Thread Ryan Waldron
You'll also need to remove that migration's entry from the 'schema_migrations' table. That's how Rails keeps up with what migrations exist, and whether it's done them all. On Tue, Apr 6, 2010 at 10:10 PM, GoodGets wrote: > What exactly does rake db:migrate:down VERSION=XXX do?  I understand > th

Re: [Rails] Re: group objects by month

2010-04-06 Thread Ryan Waldron
If :birth_date is a Date, for instance, you could do it like this: @dogs.group_by{|dog| dog.birth_date.month} On Tue, Apr 6, 2010 at 9:36 PM, eggie5 wrote: > or group by week for that matter... > > On Apr 7, 11:35 am, eggie5 wrote: >> I have a collection of of objects from an query. I can group

Re: [Rails] Finding non-empty has_many associations with a named_scope

2009-12-12 Thread Ryan Waldron
;customers.id" With the :group added, it worked, so you rock! Thanks so much for the help! On Sat, Dec 12, 2009 at 6:41 PM, Leonardo Mateo wrote: > On Sat, Dec 12, 2009 at 7:40 PM, Ryan Waldron wrote: > > If I have these classes: > > > > class Customer < Acti

[Rails] Finding non-empty has_many associations with a named_scope

2009-12-12 Thread Ryan Waldron
If I have these classes: class Customer < ActiveRecord::Base has_many :jobs ... end class Job < ActiveRecord::Base belongs_to :customer ... end can I construct a named scope that returns the equivalent collection (but hopefully more efficient) to this: customers_with_jobs = Customer.all.rej

[Rails] Re: nested hash and nil question

2009-05-12 Thread Ryan Waldron
What value should 'zip' contain if postal_code_number doesn't exist (or any of the keys above it)? If one of the keys in that long nasty chain are nil, you're going to get an exception, but if you know an acceptable default value in case you can't eval the whole expression, rescue the exception an

[Rails] Re: number_to_currency doesn't work...

2009-04-19 Thread Ryan Waldron
Works for me on 2.3.2. What version/platform/etc.? Any other relevant details you can share? On Sun, Apr 19, 2009 at 3:05 PM, Heinz Strunk < rails-mailing-l...@andreas-s.net> wrote: > > Hey, > > I have no idea but for some reason number_to_currency doesn't work in my > application. > > <%= numb

[Rails] Re: cycle(...) - is there some sort of only_first_time(...)?

2009-04-19 Thread Ryan Waldron
It might be instructive to look at the code for the cycle method. It actually creates an object and calls its to_s method each time you call 'cycle'. You could do a similar thing. Create a small class with a 'to_s' method that returns something the first time, but nothing thereafter. class Once

[Rails] RESTfully dealing with a non-RESTful client

2009-04-03 Thread Ryan Waldron
I'm working with a PBX that, given a URL string with some pre-defined fields, will invoke that URL with the fields filled in with collected data on certain call events. For instance, if you give it the proper string to invoke for each new call, then when "Joe Bob" at "123-456-7890" calls, it will

[Rails] Re: :first and :all giving different first records

2009-03-31 Thread Ryan Waldron
; > Fred > > Best of luck! Post your response when you figure it out. :-) > > > > -Danimal > > > > On Mar 30, 4:20 pm, Ryan Waldron wrote: > > > > > I'm trying to track down a strange test error. This project has Rails > 2.1.0 > > > frozen in v

[Rails] Re: Restful_Authentication test failure

2009-03-30 Thread Ryan Waldron
And changing it to > class UserTest < ActiveRecord::TestCase > did not change the error I am getting. > > Is there something else I'm supposed to be doing? > > Thanks > > On Mar 31, 11:17 am, Ryan Waldron wrote: > > Take a look at this ticket: > > &g

[Rails] Re: Restful_Authentication test failure

2009-03-30 Thread Ryan Waldron
by the controller. > class UsersController; def rescue_action(e) raise e end; end > > class UsersControllerTest < ActionController::TestCase > fixtures :users > > --- > > I also forgot to say that I have installed exception_notification and > resource-

[Rails] Re: Restful_Authentication test failure

2009-03-30 Thread Ryan Waldron
What version of Restful_Authentication are you using? Can you post perhaps the top 10 lines of your test/unit/user_test.rb and test/functional/users_controller_test.rb files? On Mon, Mar 30, 2009 at 6:04 PM, elle wrote: > > Hello, > > I've been searching for an answer and couldn't find one -- s

[Rails] :first and :all giving different first records

2009-03-30 Thread Ryan Waldron
I'm trying to track down a strange test error. This project has Rails 2.1.0 frozen in vendor/rails . On my MacBook Pro, the problem boils down to this: (rdb:1) Invoice.first(:order=>'id desc') # (rdb:1) Invoice.find(:all, :order=>'id desc').first # I'm in the debugger in the middle of a test

[Rails] Re: HTTP Basic Authentication permitting wrong passwords through

2009-01-22 Thread Ryan Waldron
On the plus side, I got to walk through how before_filters are called using ruby-debug. New knowledge FTW! On Mon, Jan 19, 2009 at 12:49 AM, Ryan Waldron wrote: > Hey, Patrick! Thanks for the reply. > > On Sun, Jan 18, 2009 at 7:25 PM, Patrick Doyle wrote: > >> On Sun

[Rails] Re: ActionMailer and url_for in helper methods

2009-01-19 Thread Ryan Waldron
so I don't want to hardcode or pass around a > host variable everywhere (because there are a lot of URLs being > generated). I thought the ActionMailer::Base.default_url_options[:host] > would help but it doesn't seem to work inside the scope of helper > methods. > >

[Rails] Re: quick answer needed on dependancy

2009-01-19 Thread Ryan Waldron
On Mon, Jan 19, 2009 at 1:01 PM, Dave Smith < rails-mailing-l...@andreas-s.net> wrote: > > Hi Guys, > > I have a mail_templates table > I have a mailinglists table > I have a mail_templates_mailinglists table with mailtemplate_id, and > mailinglist_id > > mail_template has_and_belongs_to_many :mai

[Rails] Re: Date Range comparison

2009-01-19 Thread Ryan Waldron
You can do this in ActiveRecord is Room.find :first, :order => 'created_at desc' See http://ts.freelancing-gods.com/rdoc/classes/ThinkingSphinx/Search.html#M71for more about ordering search results, which is really what you want. I don't think the AR flavor I gave above is likely to work out

[Rails] Re: HTTP Basic Authentication permitting wrong passwords through

2009-01-18 Thread Ryan Waldron
Hey, Patrick! Thanks for the reply. On Sun, Jan 18, 2009 at 7:25 PM, Patrick Doyle wrote: > On Sun, Jan 18, 2009 at 12:45 AM, Ryan Waldron wrote: > >> >> I've run into a strange problem with HTTP Basic authentication. I've >> observed this behavior on

[Rails] Re: ActionMailer and url_for in helper methods

2009-01-18 Thread Ryan Waldron
Use the :host option to make it build the whole URL, like this: url_for( {:host =>'customerdomain.com', :controller => 'page', :id => 1 } ) On Sun, Jan 18, 2009 at 2:57 PM, Conrad Chu < rails-mailing-l...@andreas-s.net> wrote: > > Hi, > > I was wondering how to get url_for to work inside ActionM

[Rails] Re: RedCloth + Ajax problem

2009-01-18 Thread Ryan Waldron
If you're using link_to_remote to call an action which has an RJS template, you need to remove the "update => 'page_content'," argument in link_to_remote. If you specify :update, link_to_remote expects to get back some HTML with which to replace that element of your DOM. When you leave that off,

[Rails] HTTP Basic Authentication permitting wrong passwords through

2009-01-17 Thread Ryan Waldron
ment Database adapter mysql Database schema version 20090114205156 This is a VERY simple app; no tricky stuff going on, just a basic CRUD thing with a couple of models. I have no idea what is going on here. Anybody know what I'm doing wrong here? Ideas or suggestions? -- Ryan Waldro