[Rails] Rails 3: new namespace inside nested resource?

2010-04-18 Thread Adriano Nagel
Hi, Is there a way to use namespaces inside nested resources? For example, I have: resources :users do resources :tags end and I'd like to place the tags controller inside controllers/users, with the equivalent for templates. If I try this: resources :users do namespace :users do resou

[Rails] Re: Design - Best practices on managing many-to-many controllers?

2010-04-17 Thread Adriano Nagel
I decided to create a restful controller for the tags, nested in the users resources, and not associated with any model: resources :users do resources :utags, :only => [:index, :create, :destroy] end I'm using these routes in the views: <%= link_to 'destroy', user_utag_path(@user, tag)

[Rails] Design - Best practices on managing many-to-many controllers?

2010-04-17 Thread Adriano Nagel
Hi, This may seem a silly question, but I didn't find an elegant solution to manage a user's tag collection. Perhaps I'm missing something, I'd like to know if there is a better way to handle it are. The configuration is pretty standard stuff: user.rb: has_many :user_tags, :dependent => :destr

[Rails] Re: Strange Active::Record behavior, StatementInvalid exception thrown twice?

2009-08-26 Thread Adriano Nagel
On Aug 26, 11:56 am, Adriano Nagel wrote: > has_many :entries, :dependent => :delete_all >   save! # will fail if an exception is thrown below Nothing like explaining your problem to others :-) I figure feed.save tries to save the associated entry and that throws the exception again

[Rails] Strange Active::Record behavior, StatementInvalid exception thrown twice?

2009-08-26 Thread Adriano Nagel
Hi, I'm a bit puzzled with an ActiveRecord::StatementInvalid exception that's apparently being thrown twice. I'm using Rails 2.3.3 and Postgres, and inside the Feed Model I have something like: has_many :entries, :dependent => :delete_all def process_feed ... process_feed_entries # log s

[Rails] Re: Aggregation: problem with uninitialized composed_of object

2009-01-16 Thread Adriano Nagel
For the record... On Jan 16, 4:17 pm, Adriano wrote: > TypeError: wrong argument type String (expected Fixnum) [snip] >   def initialize(string) >     @value = BigDecimal(string.sub(/,/, '.')) >   end The problem was that value object can be initialized with a string (from the form) or with a