[Rails-core] small extension to link_to_if

2013-12-17 Thread angelo capilleri
Hi I frequently use link_to in the context of conditional statement, What do you think about a link helper that return nil when the condition is false ex: # condtional = nil || false %= link_to_if conditional, an_url, allow_hide: true % # = nil or %= link_to_if! conditional, an_url % #

Re: [Rails-core] small extension to link_to_if

2013-12-17 Thread angelo capilleri
/link_to_unless On 17 Dec 2013, at 14:43, angelo capilleri capi...@gmail.comjavascript: wrote: Hi I frequently use link_to in the context of conditional statement, What do you think about a link helper that return nil when the condition is false ex: # condtional = nil || false %= link_to_if

[Rails-core] ActiveModel ::Errors

2013-01-30 Thread angelo capilleri
I want made a PR to get the possibility to add more attribute for errors.add method: Ex. Now: ... validate dates_must_be_coherent def dates must be coherent if start.present? stop.present? start stop errors.add(:start,date must be ) errors.add(:stop,date must be)

Re: [Rails-core] Re: Active Record, changes from.. to..

2012-12-19 Thread angelo capilleri
, 2012 9:14:33 AM UTC-5, angelo capilleri wrote: Hi, I'm thinking about a method that responds true or false for the changes of attributes from a value to another to trace a little bit the status of an AR object. Ex. class Book ActiveRecord::Base STATUS_DELIVER = [0,1

[Rails-core] Active Record, changes from.. to..

2012-12-17 Thread angelo capilleri
Hi, I'm thinking about a method that responds true or false for the changes of attributes from a value to another to trace a little bit the status of an AR object. Ex. class Book ActiveRecord::Base STATUS_DELIVER = [0,1] before_save :send_mail_to_customer def send_mail_to_customer

[Rails-core] URL ID

2012-07-08 Thread angelo capilleri
Many users try to overwrite the to_param method of AR to add more expressivness and value of Seo to the url using something like the following: def to_param id.to_s + title. parameterize + '-' + author. parameterize end That generate url like that: http://host/books/10-goodbook-guest

[Rails-core] Add option notice to validate option

2012-06-11 Thread angelo capilleri
Frequently, I want use some validation with no error that blocks the updating or saving process, but give an object with some usefull informations to the controller. So i thing that a 'notice' option could be added to ActiveModel. For example validate :age, :numericality = true, :notice=true

[Rails-core] Set a tag of a collection rendering

2012-04-29 Thread angelo capilleri
Could useful set the tag of a collection when you render it, like backboneJS? for example , given a partial: ```erb span%=post.autor%/span span%=post.created_at%/span ``` you could render inside two different tags ```erb ul %= render @posts,:tag='li'% /ul ``` output: ```html ul li