[Rails-core] #3177[PATCH] has_many_through doesn't work

2005-12-11 Thread Abdur-Rahman Advany

Hi,

made 3 models

Article (has_many :categories, :through => :publishes) Publish 
(belongs_to :articles, belongs_to :categories) Category (has_many 
:articles, :through => :publishes)


then I tryed to fetch the category's belong to articles and it made a 
wierd sql query...


MysqlError? : You have an 
error in your SQL syntax; check the manual that corresponds to your 
MySQL server version for the right syntax to use near / at line 1: 
SELECT categories.* FROM categories, publishes WHERE (categories.id = 
publishes.category_id AND publishes.#_id = 1) /


look at "publishes.#", so I changed has_many_through 
to work as it should


just added owner.class.to_s instead of owner.to_s

please check the diff in the link http://dev.rubyonrails.org/ticket/3177





___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] link_to broken for modules

2005-12-11 Thread Nathaniel S. H. Brown
For ticket http://dev.rubyonrails.org/ticket/1360

It was originally marked for the 0.12 release, but still hasn't been fixed.

What's the status on this?


~
 Nathaniel S. H. Brown   http://nshb.net 
~

___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] link_to broken for modules

2005-12-11 Thread David Heinemeier Hansson
> For ticket http://dev.rubyonrails.org/ticket/1360
>
> It was originally marked for the 0.12 release, but still hasn't been fixed.
>
> What's the status on this?

The status is that it's still not fixed and I haven't heard of anyone
working on it. Please do create a fix and post the patch on that
ticket.
--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com   -- Online project management
http://www.backpackit.com   -- Personal information manager
http://www.rubyonrails.com  -- Web-application framework
___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] #3177[PATCH] has_many_through doesn't work

2005-12-11 Thread David Heinemeier Hansson
> just added owner.class.to_s instead of owner.to_s

Applied. And added tests to verify the behavior. Thanks.
--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com   -- Online project management
http://www.backpackit.com   -- Personal information manager
http://www.rubyonrails.com  -- Web-application framework
___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core


Re: [Rails-core] #3177[PATCH] has_many_through doesn't work

2005-12-11 Thread Abdur-Rahman Advany

sorry, next time I will include the tests

David Heinemeier Hansson wrote:


just added owner.class.to_s instead of owner.to_s
   



Applied. And added tests to verify the behavior. Thanks.
--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com   -- Online project management
http://www.backpackit.com   -- Personal information manager
http://www.rubyonrails.com  -- Web-application framework
___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

 



___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core


[Rails-core] string_to_time ignoring timezone

2005-12-11 Thread Josh Harvey
Is there a reason string_to_time discards timezone information? (See 
activerecord/lib/active_record/
connection_adapters/abstract/schema_definitions.rb.)

def self.string_to_time(string)
  return string unless string.is_a?(String)
  time_array = ParseDate.parsedate(string)[0..5]
  # treat -00-00 00:00:00 as nil
  Time.send(Base.default_timezone, *time_array) rescue nil
end 

I would have suggested using Time.parse, but when the supplied string doesn't
have a timezone, it interprets the datetime as local, which is not always what
we want.

It might be worth overriding the parse (or make_time) method in Time to support
defaulting to either :local or :utc. This would make timezone support in
string_to_time as easy as:

def self.string_to_time(string)
  return string unless string.is_a?(String)
  # treat -00-00 00:00:00 as nil
  Time.parse(string, Time.now, Base.default_timezone) rescue nil
end 

-- Josh

___
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core