[Rails] serialize methods by to_json

2009-06-23 Thread Gregory Peck
Hello, Is there possible to pass arguments for serialized methods using to_json?? I want to serialize my collection of users with income and outcome which is calculate by methods: collection.to_json(:methods => [:income, :outcome]) But, what if I need to pass some arguments to method :outcome ?

[Rails] Array unshift and save to database

2009-06-22 Thread Gregory Peck
Hello, I've noticed that I can't save my object to the DB after using 'unshift' on one of Array fileds. Ex: (below 'tags' is a collection in object 'transaction') transaction.tags.unshift(Tag.find_or_create_by_name(name)) transaction.save! Everything is fine when I am using '<<' to append tag

[Rails] observe_field and disptcher problem

2008-12-10 Thread Gregory Peck
Hello everyone, I am trying to make live-search list with observe_field and I still have the problem with invoking the proper action. Take a look at the following code: index.html.erb: <%= text_field_tag "search" %> <%= ob