[Rails] Re: errors.add, setting the whole message

2010-10-13 Thread Sjoerd Andringa
Sjoerd Andringa wrote in post #949781: > Perhaps I18n.t's :default option is overridden? Forget about that, it merges the default scope into the options hash so it always takes precedence. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribe

[Rails] Re: errors.add, setting the whole message

2010-10-13 Thread Sjoerd Andringa
Here you can see how the 'full_messages.format' scope is applied: http://github.com/rails/rails/blob/v2.3.4/activerecord/lib/active_record/validations.rb#L118 Maybe it'll give you some insight in why it's not working. Perhaps I18n.t's :default option is overridden? Good luck! -- Posted via http

[Rails] Re: errors.add, setting the whole message

2010-10-13 Thread Sjoerd Andringa
It seems this feature has been added in 2.3.5 (http://github.com/rails/rails/blob/v2.3.5/activerecord/lib/active_record/validations.rb#L108). I'd recommend upgrading as Im not aware of an easy alternative way of doing this. -- Posted via http://www.ruby-forum.com/. -- You received this mess

[Rails] Re: errors.add, setting the whole message

2010-09-24 Thread Sjoerd Andringa
If you're using I18n (which I think is always a good idea, even if you're only using one language) you can do two things: 1. Define a translation for the job_role_id_short attribute: In app_root/config/locales/en.yml: en: activerecord: attributes: my_model:

[Rails] Re: how to make an ajax call to redirect

2010-09-24 Thread Sjoerd Andringa
Vicer Ontero wrote: >> And make sure you're *not* using the :update option on your remote_form. >> 'page.redirect_to()' will generate javascript similar to Hassan's >> aforementioned suggestion. > > Hi, just a note that this does not work. Because the redirect gets > trapped inside the Ajax cal

[Rails] Re: how to get root path with link_to ?

2008-10-27 Thread Sjoerd Andringa
Patrick Sullivan wrote: > Or you could just do this: > > link_to "Link", "/" True, however won't that just generate a relative url? So Link instead of http://www.mysite.com/";>Link? I believe Guillaume requires the latter, as his views are also used outside of his app. -- Posted via http://ww

[Rails] Re: Ajax Failure Idiom

2008-10-27 Thread Sjoerd Andringa
Sjoerd Andringa wrote: > I dont know of a commonly used pattern for this, all of your suggestions > seem okay. Of course you don't need to parse xml and then update an > element, in a lot of situations just returning an html fragment and > update some element directly wi

[Rails] Re: Ajax Failure Idiom

2008-10-27 Thread Sjoerd Andringa
I dont know of a commonly used pattern for this, all of your suggestions seem okay. Of course you don't need to parse xml and then update an element, in a lot of situations just returning an html fragment and update some element directly will suffice. In an application I developed recently, wh

[Rails] Re: how to get root path with link_to ?

2008-10-25 Thread Sjoerd Andringa
guillaume wrote: > Hi, > > I would like to get the root path of my website using link_to in a > view... (for example : http://www.mywebsite/controller/action/id) > how is that possible ? > > (i do need it, because i use the generated code in the view outside of > the rails app') > > Thanks.. i

[Rails] Re: Composing several named_scopes into another

2008-10-25 Thread Sjoerd Andringa
Kip Cole wrote: > I have several named scopes in my app. Some patterns are > used commonly. For example: > > Article.published_in(publication).published.viewable_by(current_user).included_in_index > > Since this pattern is repeated, I'd like to be able to have a > named_scope that embeds this

[Rails] Re: render :update / page.replace_html problem

2008-10-18 Thread Sjoerd Andringa
If you need this to be Ajaxified use remote_form_for instead, also check out: http://www.caboo.se/articles/2007/4/2/ajax-file-upload, as you're uploading file data. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: how to make an ajax call to redirect

2008-10-18 Thread Sjoerd Andringa
Hi daociyiyou , Try this: def find_created_actions unless @if_login flash[:login]="..." redirect_to(:controller=>"login",:action=>"login") end if @if_login @[EMAIL PROTECTED] render :update do |page| page.replace_html 'element_id', :p