[Rails] Re: Re: What is the number of Ruby instances needed on a server?
Got it, thanks a lot guys! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: What is the number of Ruby instances needed on a server?
Thanks, Fred! 1 question back - if you say... > ...and your instances can handle 10 > requests/s then... ...is the "10 requests/s" per instance the average capacity of a Ruby instance? If not, do such figures exist or make any sense? Or would I have to calculate my own instance capacity, simply based on what my server's hardware actually swallows during usage? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] What is the number of Ruby instances needed on a server?
Hi there, what does the number of Ruby instances a server keeps running really depend on? Can I model/calculate that somehow as a function of the number of users on the website or do I just have to wait and see how the situation evolves? I really do hope it's not 1 ruby instance per user that's necessary, because the instances I saw on my server were all using between 120MB and 140MB of memory, which seems huge to me (I'm a novice to all that, though). Thank you very much for any explanations! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: I18n in model validations: Possible or not?
Thanks for all the input! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: I18n in model validations: Possible or not?
> I'll check with the guy that did it an see if he has an answer for you... Thanks - why not, if there's a better/more elegant trick than the solution above (it works...). Cheers, Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I18n in model validations: Possible or not?
> It may work for the default "keys" (for "validates_presence_of :name" > the key would be "blank"), but not the custom ones. To sum it up: The solution is NOT to include any *custom* message keys in the models, like... :message => I18n.t('activerecord.errors.models.my_model.attributes.whatever.please_select_whatever') The model will then apply the default message keys, for example ":inclusion" in the case of "validates_inclusion_of" ...and in config/locales/en.yml you need to have: en: activerecord: errors: models: my_model: attributes: whatever: inclusion: "Please select whatever." # see key: "inclusion" -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I18n in model validations: Possible or not?
> In the model: > > validates_inclusion_of :whatever, :in => [true, false], :message => > I18n.t('activerecord.errors.models.my_model.attributes.whatever.please_select_whatever') > > > In config/locales/en.yml: > > en: > activerecord: > errors: > models: > my_model: > attributes: > whatever: > please_select_whatever: "Please select whatever." Nope, this doesn't work. I suspect it's still the same problem: it seems not possible to have translations in models (since they only get loaded once). It may work for the default "keys" (for "validates_presence_of :name" the key would be "blank"), but not the custom ones. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I18n in model validations: Possible or not?
> http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models > > In particular see the table in section "5.1.2 Error Message > Interpolation" Thanks, that helped. The following works: In the model: validates_inclusion_of :whatever, :in => [true, false], :message => I18n.t('activerecord.errors.models.my_model.attributes.whatever.please_select_whatever') In config/locales/en.yml: en: activerecord: errors: models: my_model: attributes: whatever: please_select_whatever: "Please select whatever." -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I18n in model validations: Possible or not?
> then apply the > translation in the view layer. Thanks... In that case, how could that be done if I have the following partial, for the error messages? <%= error_messages_for :whatever_model, :header_message => nil, :message => nil %> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: I18n in model validations: Possible or not?
> :message =>lambda { I18n.t('please_select_whatever') } Thanks for the suggestion - unfortunately, it doesn't change the outcome... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] I18n in model validations: Possible or not?
Hi there, I have the following validation in a model: validates_inclusion_of :whatever, :in => [true, false], :message => I18n.t('please_select_whatever') It seems that the translation does not work in production mode: in all languages it's always the english translation that gets diplayed (probably because I set english as the default locale in my app...?). So I am assuming that we can't translate validations in models, because models get loaded only once - when the server is booted (and then, the default locale would be applied). Am I right? If yes, how would you solve this problem? Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to use a partial in multipart/alternative emails (HTML and plain text)
No ideas at all? (Am I the only one with this problem?) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to use a partial in multipart/alternative emails (HTML and plain text)
Hi there, I use a partial in various multipart emails (HTML and plain text) in Rails and have the following problem with it: - All email "views" exist normally: both in .text.plain.erb and .text.html.erb versions - The partial (which is located in the "shared" views folder), also exists in both versions using the required endings (as mentioned above). The problem: In the "plain text" version of the received emails, it is the HTML partial that is rendered, not the "plain text" one. (Everything else is rendered correctly in both versions.) What am I probably doing wrong? Thanks a bunch for any help with this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ferret installation
I suspect you're trying to install a 32bit version on a 64bit machine... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] :disable_with combined with Ajax form: Possible?
Hi there, I'm trying to have an Ajax form with a submit button that has the :disable_with feature, but the submit button does *not* disable... I tried like this: = = = <% form_remote_tag :url => { :controller => 'profiles', :action => 'update' }, :method => :put do -%> <%= submit_tag 'Save', :disable_with => 'Please wait...' %> <% end -%> = = = Is such a combination not possible or am I doing something wrong? Thank you for any help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] MySQL - How to “SUM” in a :has_many case
Hi there, I have the following tables... User :has_many Purchases Item :has_many Purchases ...where Item has a column "amount" (can be + or -) and I need to find all Users that have a positive SUM of "amounts" (over all Purchases each one has made). How does this query look like? (I'm not sure how to handle "SUM" correctly, in this case.) I started out with the following, but obviously, it's wrong... (it wouldn't "include" Purchases that have an Item with a negative "amount"...) @users = User.find(:all, :include => {:purchases => :item}, :select => "SUM(item.amount)", :order => "...", :conditions => "...", :group => "users.id", :having => "SUM(item.amount) > 0" ) Thanks for your help with this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Helper in Initializer: Is it possible ?
Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Helper in Initializer: Is it possible ?
> What are you trying to achieve? Basically, I put some Rufus scheduler code in the Initializer folder so the scheduler runs fine, even when the hoster needs to reboot the machine for whatever reason and without my knowledge. The Rufus scheduler includes some .pdf-generating code (amongst other features). The .pdf must display numbers in a special format. And until now, I used helper code to get the numbers into this format, so it would have been convenient to use the same helper within this Rufus scheduler initializer.. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Helper in Initializer: Is it possible ?
Hi there, is there a way in Rails to use helpers in an Initializer ? If yes, how ? If no, where else to put the code needed in the Initializer (as well as in views) ? In the application_controller.rb ? Thanks for any hints! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Prawn gem: How to create the .pdf from an *existing* file
Turns out the Prawn gem cannot handle existing files... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Prawn gem: How to create the .pdf from an *existing* file
Hi there, Can anybody show me (maybe copy/paste a simple code example) how to create the .pdf file from an existing (.xls) file, using the Prawn gem? Basically, I'd need the command that takes an existing (.xls) file to save it as a .pdf, afterwards. (I'm asking because the Prawn documentation at http://prawn.majesticseacreature.com/docs/ seems to be gone since quite a while - it's not even usable via Google cache, anymore...) Thanks a lot for any help with this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Time-dependent values/constants in Models: An issue or not?
Got it - thanks a bunch ! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Time-dependent values/constants in Models: An issue or not?
Thanks a lot for your explanation (I believe a lot of folks are not necessarily aware of this "detail"...). One question back, though: Is the issue rather... a) with Rails' "Time.now" VS MySQL's "UTC_TIMESTAMP()" (where the former would *never* return the "true now" when used *anywhere within a Class* and the latter would always be returned as the "true now"), or is the issue... b) with the *context* of the "time constant" (equally in both cases), where the constant would always return the "true now" if it is used: - *within a method* of a Class, or - within a named_scope, together with a lambda, - but NOT *outside of a method* within a Class? You also say: > The reason the above fails is that Time.now is evaluated *once* when the > class is loaded. -> Are a Class' methods not also evaluated only *once*? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Time-dependent values/constants in Models: An issue or not?
Hi there, I remember reading in the comments of a Rails blog something along these lines: "Since a Model is loaded only once in production development (at server start), certain time-dependent 'constants' that you have placed in a method of a Model will always return the same value for those 'constants', i.e. the value the 'constant' had at server start." Hypothetic example for the MySQL 'constant' "UTC_TIMESTAMP()" in a Model 'User': = def books_created_right_now self.books.find(:all, :conditions => "books.updated_at = UTC_TIMESTAMP()") end = Is the above statement utter BS or is there actually some issue similar to the example or statement? Thanks a lot! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Scheduled tasks in Rails: Cron + wget = Best solution?
Thanks for all your suggestions! (I like rufus-scheduler pretty much -> small memory foot print...) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Scheduled tasks in Rails: Cron + wget = Best solution?
Hi there, do you agree that for having scheduled tasks in Rails, the leanest solution is the following? - Create a controller with an action for each task - Implement the logic of the task as controller code - Set up a cron job at the OS level that uses wget to invoke the URL of this controller/action at the appropriate time intervals Advantages: 1) full access to all your Rails objects just as in a normal controller 2) you can develop and test just as you do normal actions 3) you can also invoke your tasks adhoc from a simple web page 4) You don't consume any more memory by firing up additional ruby/rails processes My additional question is: How would the cron job entry have to look like in order to let cron "log in" (as admin for example) before calling the action (for obvious security reasons)? This is what I have until now: 20 * * * * /usr/bin/wget --quiet -O - 'http://www.mydomain.com/my_controller/my_action' Thank you for opinion and/or hints! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: :joins VS :include => different results?
> A.find(:all, :conditions => 'a.column=1 AND b.column=2', :include => > 'b') # join And if you say "join", you mean a "LEFT join" here, if I got the story right... Thanks, guys! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: :joins VS :include => different results?
> :joins does an inner join, :include doesn't (and may not even do a > join at all) If you say "may not", when would it do or not do a join, then? And which type of join? Doesn't :include amount to a LEFT JOIN, actually? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] :joins VS :include => different results?
Hi there, assume that: 1 we have the following situation: Book :has_many Pages :has_many Illustrations = = 2 certain pages have NO illustrations 3 the following 2 cases: A) Book.find(:all, :joins => [:pages => [:illustrations]]) B) Book.find(:all, :include => [:pages => [:illustrations]]) Question: Is it correct that: - in case A), the books containing pages WITHOUT any illustrations will NOT show up in the results - whereas in case B), these books WILL show up? (Personally, I thought that the main difference between :joins and :include was the "eager loading" part.) Thanks for any explanation for this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Re: Model.find statements: SQL condition format -> How?
> PS In re-reading my earlier posts I sound a little stroppy/terse... > maybe I'm just in a "Marnen" mood today... apologies if it wasn't > apparent that I'm actually keen for you to understand and solve your > problem. Yeah, I want my money back! ;-) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Model.find statements: SQL condition format -> How?
> What wasn't? Without quoting a previous message, no one knows what > you're replying to. I was replying to the last message: "there should be an extra ')'" > Again, I'll ask you; what bit of the API did you find confusing? It's just that based on the API, I couldn't figure out if/where/how to place the "count" part in the find statement... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Model.find statements: SQL condition format -> How?
Well, just like the answer to my question, this wasn't obvious from the API. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Model.find statements: SQL condition format -> How?
Yep, I would have liked to be able to use Rails without needing to dig deeper into SQL - at least as long as I'm not a professional coder... Anyways, from what I understand, the answer to my question is: With Rails, I need to use the :select parameter to have the "count part" (as described above), like so (and in combination with the :having parameter): :select => "people.*, count(people.id)" :having => "count(people.id) > 1" Thanks for your participation and patience! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Model.find statements: SQL condition format -> How?
Thanks for getting back! Well, to put it bluntly: I cannot figure out what parameter(s) (like :limit, :group, etc.) of the find method I have to use to create the count "condition" in the find statement. By "count condition" I mean the part: number-of-authors-must-be-greater-than-5 Assume that we're in a simply Model_A :has_many Model_B case like... Book :has_many Authors ...and that I'd like to avoid the find_by_sql method (raw SQL), if possible. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Model.find statements: SQL condition format -> How?
Yep, it's really the "number of authors" part that I have not understood yet. If I try as you say (using authors.count > 5 in the "conditions") an error message tells me that there is no column called "count"... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Model.find statements: SQL condition format -> How?
Thanks - and no worries re the model, it's just an example... Actually, I asked this question since I'd like to stick as much as possible to the "Rails way" of doing things (and therefor I'd like to try to avoid things like "original" SQL statements). So, any idea how the part... :conditions => "books.published = TRUE AND number-of-authors-must-be-greater-than-5" ...would have to be? (In the Rails kind of way?) (I tried using the API, but don't seem to get it.) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Chat app, Caching? Observe?
Maybe you want to give this a try (there seems to be "no activity" currently, though...) http://code.google.com/p/canhaschat/ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Model.find statements: SQL condition format -> How?
Hi there, What's the correct end part of "conditions" if: - you assume that "Book :has_many Authors" - I'd like to have the find statement in the below format @books = Book.find(:all, :joins => [:authors => [...]], :include => :whatever_stuff, :conditions => "books.published = TRUE AND number-of-authors-must-be-greater-than-5") Thank you for your help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ajax submit: Clicking 'Submit' vs. hitting ENTER
Thanks for all the feedback! Fred's nailed it and all other hints were instructive as well! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Ajax submit: Clicking 'Submit' vs. hitting ENTER
Hi there, Has anyone an idea why the below form - submits correctly when I click the 'Submit' button - but does call the 'new' action instead of 'create' when I hit ENTER? <% form_remote_tag :html => { :action => url_for(:controller => 'pages', :action => 'create') } do -%> <%= text_field :page, :title %> <%= submit_to_remote 'blah', 'Submit', :url => {:controller => 'pages', :action => 'create'} %> <% end -%> Thanks a lot for any hints! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Error: "ActionController::InvalidAuthenticityToken"
I can confirm that I use the RESTful authentication plugin, too. Thanks for your input! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Error: "ActionController::InvalidAuthenticityToken"
Only sometimes... Maybe due to bots...? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Smooth scrolling with RJS -> error
Hi there, can anybody tell me what's wrong with this controller part...? render :update do |page| page.call "jQuery('html,body').animate({ scrollTop:jQuery('#top').offset().top}, 2000)" end The error I get is... "RJS error: TypeError: jQuery("html,body").animate({ scrollTop:jQuery("#top").offset().top}, 2000) is not a function" The idea is to have the controller "smooth scroll" to the DIV with the ID 'top' (which would contain the error message). (Nothing else besides the jQuery core is needed with this code.) Thanks for any help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to: Set a datetime params-value to nil in the controller
Thanks for the explanations - they helped! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to: Set a datetime params-value to nil in the controller
Thanks for your inputs. Unfortunately, I can add that: 1. Yes, the code definitely GETS executed 2. No, params[:task] is definitely NOT nil 2. Other values of the Task object in params CAN be set to nil, for example... params[:task][:name] = nil ...works correctly. Could it be that "...[:enddate]" is not sufficient in... params[:task][:enddate] ...because the date gets submitted by a date_select? When I check what values get passed to params, I see... task[enddate(1i)] -> 2011 task[enddate(2i)] -> 3 task[enddate(3i)] -> 1 Could it be that the problem stems from the "(1i), (2i), (3i)" part? Any ideas? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to: Set a datetime params-value to nil in the controller
Hi there, Suppose I submit an object called "task" from a form with... task[enddate(1i)] -> 2011 task[enddate(2i)] -> 3 task[enddate(3i)] -> 1 ...how do I set the value 'params[:task][:enddate]' to 'nil' in the controller? I tried... params[:task][:enddate] = nil ...but that doesn't seem to "empty" the attribute 'enddate'. What am I getting wrong? Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to convert a "time difference" into "x days, y hours..."
Great! Thanks a lot, guys! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to convert a "time difference" into "x days, y hours..."
Hi there, how can I convert something like... future_datetime - past_datetime (which results in a float) into something like... "21 days, 2 hours, 53 minutes, 1 seconds" ? Does RoR have any nifty helper for this ? Thanks a lot for any hint! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: Ajax-submit form on "check box onclick ": why this error?
Any idea how the code would have to be, in order to achieve my goal? (see 1st post) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Ajax-submit form on "check box onclick ": why this error?
Hi Colin, it's this one here: http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001653 (in order to ajax-submit a form using form_remote_tag, see code above...) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ajax-submit form on "check box onclick ": why this error?
Anyone...? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ajax-submit form on "check box onclick ": why this error?
Thanks for your answer. Unfortunately, if I try... :onclick => "remote_function('this.form.submit();')" ...then I get an error (by Firebug): "remote_function is not defined" Any other ideas? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Ajax-submit form on "check box onclick ": why this error?
Hi there, I need to have a checkbox which ajax-submits a form. The following code throws an error "index 112009 out of string". What's wrong here? == <% form_remote_tag :url => { whatever_url } do -%> <%= check_box_tag 'whatever', nil, whatever, { :onclick => "#{remote_function('this.form.submit();')}", :disabled => false } %> <% end -%> == Thanks for any help with this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Error: "ActionController::InvalidAuthenticityToken"
Thanks for your hints... Well, the code is actually the following: <%= check_box_tag 'applicationfile_verified', nil, applicationfile.verified, { :onclick => "#{remote_function(:url => { :controller => 'applicationfiles', :action => 'verify', :id => applicationfile.id })}" } %> ...which results in the following source... And since the source includes... " data:'authenticity_token=' + encodeURIComponent('xV3Ayw...9Nnjs=') " ...it would mean the Authenticity Token is there and OK, right? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Error: "ActionController::InvalidAuthenticityToken"
Hi there, I have my first Rails app running and I regularly get the following "logged_exception" error message: "ActionController::InvalidAuthenticityToken" Has anybody an idea what might cause this problem? Could it somehow be a "time out" error (like an "AuthenticityToken" which might expire after a certain time, or something along those lines)? Any idea how that error could be prevented from occurring? The "backtrace" always starts like this: = /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/request_forgery_protection.rb:79:in `verify_authenticity_token' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:in `send' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:in `evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:166:in `call' ... = Thanks for any help with this! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Console question
Ok, found the "bug", had to call it like this: User::MyController.mymethod ... and namespace the whole thing in routes.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Console question
Hi there, how do I execute a method in the Rails console if the controller containing the method is not located directly in the folder "app" but in the folder "app/user"? >> MyController.mymethod ...would only work if the controller were located in the "app" folder. Thanks for any hint! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: 3-second-n00b question
Thanks a lot for your quick help, guys ! Actually, all of your input is very helpful (some of it right away, some of it later)! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Googlebots - sitemaps
Maybe I got you wrong, but wouldn't a rel="nofollow" in your login-links be a solution for this situation? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] 3-second-n00b question
Hi there, my short question: Assume I have these 2 cases in my code : :name => h(agent.firstname) [...] :name => h(agent.sharedname) To stay DRY, I want this to become just 1 line, by replacing "first"/"shared" by a variable that I would set at the beginning. How would the code of this 1 new line and the initiation of the variable look like? Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to retrieve the *referring* action/controller
Thanks, Niels! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to retrieve the *referring* action/controller
Hi there, I'm posting because I didn't find the answer using search engines: How do I get the name of the action and/or controller that have sent the user to the current page? (I know one can access the *current* action/controller using controller.controller_name and controller.action_name, but I need to retrieve the the *referring* action/controller, meaning "the one before"...) Thanks a lot for any help! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to: Check if Javascript is enabled
:-) Thanks, guys! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to: Check if Javascript is enabled
Hi there, Rails has fantastic Javascript helpers, which I have immediately used for my website. Since some features of my website now rely 100% on Javascript being enabled in the user's browser, I now need a way to either: a) block the usage of the site when Javascript is disabled, or b) display a very visible message that tells the user to enable Javascript. Has anybody good ideas for a plugin (or some other solution) to check if Javascript is enabled and to then let the user know? (I know, a good programmer would let the site work without JS as well, but currently, I'm not there yet...) Thanks a bunch for any help with this! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to: redirect_to through a folder hierarchy (upwards)
Thanks, Kilari - that was it ! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to: redirect_to through a folder hierarchy (upwards)
Anyone...? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Add a lang param in routes
In case you haven't read this yet: http://guides.rubyonrails.org/i18n.html Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: List out banking application
PS: Subscribe to the following feeds to stay informed: http://www.rorsecurity.info/journal/rss.xml http://feeds.feedburner.com/RidingRails -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: List out banking application
In case you haven't read this yet, it would be a good starting point: http://guides.rubyonrails.org/security.html Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to: redirect_to through a folder hierarchy (upwards)
Hi Eric, My controller files contain: controllers/admin/incidents_controller.rb: class Admin::IncidentsController < ApplicationController ... end controllers/members_controller.rb: class MembersController < ApplicationController ... end - I am in the 'Admin::IncidentsController < ApplicationController', and need to - redirect_to the 'show' action in the 'MembersController < ApplicationController' I also tried something this: redirect_to :controller => '../members', :action => 'show' Thanks for helping! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to: redirect_to through a folder hierarchy (upwards)
Hi there, how do I tell the current controller correctly to redirect_to an action of another controller that is 1 level higher in the folder hierarchy than the current controller? How I have tried: Within the current controller (called 'incidents'), I have put: redirect_to :controller => 'members', :action => 'show', :id => @user.id (Where 'members' is 1 level higher. And this doesn't work.) Thank you for any help with this! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to: Reduce nbr of processes (Ruby, Apache, BackgroundRB)
Hi there, I'm currently trying to cut back on memory usage on my production server. I have noticed that I have 2 ruby processes running on my server: "ruby" and "ruby1.8". Is this normal? If not, how do I get rid of the 2nd one? For Apache, I have 6 processes running - what is that good for? How can I reduce them or should I not? Thridly, I have 3 "packet_worker_runner" (from backgroundRB) processes running. Is it possible and OK to have only 1? If yes, how? Thanks a lot for any hints! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to: Handle javascript_include_tag in production mode
Thanks! It definitely WAS a name confilct: I had used cache names (:cache => "XYZ") several times. They can of course NOT be identical... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to: Handle javascript_include_tag in production mode
Hi there, I have the following javascript_include_tags in my application.html.erb file: <%= javascript_include_tag 'jquery/jquery-1.3.2.min', :cache => 'jquery' %> <%= javascript_include_tag 'jrails' %> <%= javascript_include_tag 'jquery/jquery.autocomplete.min', :cache => 'jquery' %> <%= javascript_include_tag 'mootools/mootools-1.2.1-core-yc', :cache => 'mootools' %> <%= javascript_include_tag 'mootools/mootools-1.2-more', :cache => 'mootools' %> <%= javascript_include_tag 'mootools/formcheck/formcheck', :cache => 'mootools' %> My question: How come, when I run the *production* environment on the (virtual private) server, the javascript files don't seem to load? ("XYZ-is-not-a-fuction" errors) Hints: - When I delete the :cache options, the scripts DO load correctly. - When I'm in *development* mode, the whole problem doesn't occur at all (I can have the :cache options). Thank you for your input! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Different gem locations: reasons?
Very cool - thanks a lot, Marnen & Fred! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Different gem locations: reasons?
Hi there, as far as I know, gems can be stored in 2 folders: 1. /usr/lib/ruby/gems/1.8/gems 2. app/vendor/gems When I install a gem, it automatically goes into the 1st folder. My questions are: - What are the reasons one should store the gems in the 2nd folder (app/...)? - Does it have anything to do with deployment/"portability"? If yes, how? - How should gems be put in there? Any special command or is copy/paste OK? - Do apps automatically find the correct location of the gems? Any config to do? - How are gems in app/vendor/gems updated? Using the normal gem update command? Background info: - I'm pretty much a n00b - I plan to deploy my app to slicehost.com (unless you guys know better solutions) - At slicehost, I will have access to the entire OS (Ubuntu) Thanks for any help with this! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Render a whole HTML page after an Ajax request: possible
And I'd been starting to think I had to call McGyver... Great! Thanks, Sijo! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Render a whole HTML page after an Ajax request: possible?
Hi there, Suppose: 'action A' was launched by an Ajax request Question: Is it possible to - somehow render a whole HTML page (not only return a part of the page), or - redirect (within 'action A') to an 'action B' (which then could render a whole HTML page) Thanks a lot! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: sanitize() AND escapeHTML()/h() ?
Great, thanks a lot! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] sanitize() AND escapeHTML()/h() ?
Hi there, is it correct that one should always use both... 1. sanitize(params[:whatever_external_or_user_input_to_save_to_database]), AND 2. h(@whatever_database_record_to_display_on_page) ...in order to have the highest security level? (Besides all the other security stuff to do, of course) Thanks a lot! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Query question
Thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Query question
1 question back, though: What if need to end up having... @user = User.find(:first) ...based on a case like this: @u = '@u' ser = 'ser' Is there something as "objectize"? :-) How would the following need to be corrected? (@u+ser).objectize = User.find(:first) Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Query question
Great - thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Query question
Hi there, Why does the following query... ser = 'ser' @user = ('U'+ser).find(:first) ...not equal this one: @user = User.find(:first) ? What needs to be done so it will work? Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass a variable from a model method to a controller
Thanks! Always good to get some critical remarks & advice... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to pass a variable from a model method to a controll
You got that right, I'm not (yet) an experienced ruby programmer, but you've just helped me to get a step further - so thanks a lot, bro ! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Back in PHP/CSS hell
I like http://developer.yahoo.com/yui/ -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to pass a variable from a model method to a controller
Hi there, how can I pass a variable from a model method to the controller that calls this method? In the below code, I tried by placing "return @errormessage" in the model method and then trying to retrieve it in the controller, but it's wrong. What's the correct way to do that? Here's what it looks like until now (simplified)... In my controller: = def whatever if @user.does_my_check_pass? # <= calls the model method below... [...] else flash.now[:error] = @errormessage# <= the variable from the method render :update do |page| page.replace_html 'flash_messages', flash_messages end end end In my model: def does_my_check_pass? if [...some conditions...] return true else return @errormessage = "There was an error." # <= the variable return false end end Thanks a lot for your help! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to include a helper method in a controller
Thanks for your replies! @ Sijo: The problem was resolved by adding "include PhonenumberHelper" in the controller, as you have suggested (I was sure I had done that before...) @ bushfreakz: Any helpers in app/helpers are only available to views, by default. If you have "helper :all" in ApplicationController, all helpers in app/helpers are available to all *views* only. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to include a helper method in a controller
Hi there, why do I get the error... undefined method `format_phone_number_for' for # ... in this situation: controllers/user/mailings_controller.rb: class User::MailingsController < ApplicationController def whatever [...] [...] format_phone_number_for(@somebody) # <- why is this "undefined" ? [...] end end helpers/phonenumber_helper.rb: == module PhonenumberHelper def format_phone_number_for(parent) [...] end end And what do I have to do to have this method available in this controller? (I have already tried by including "helper PhonenumberHelper" in the controller) Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: redirect_to results in "syntax error" for
Ok, thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: redirect_to results in "syntax error" for
Thanks for your (actually super-quick) reply, Fred! To paraphrase it (correct me if I'm wrong): Whenever an Ajax request is sent (i.e. using submit_to_remote) the "rendering part" in the controller can NOT use "redirect_to :action => ..." or "render :action => ...". Rendering the response can in this case only be done using: render :update do |page| page.replace_html 'whatever', :partial => 'whatever' end "redirect_to" and "render" can only be used after "regular" requests. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] redirect_to results in "syntax error" for
Hi there, I have a strange error: In a controller, I have a... redirect_to :action => 'show' ...at the end. But upon code execution, Firebug tells me: syntax error http://www.w3.org/TR/html4/strict.dtd";> (It says that for Line 0) Does anyone have a clue what this means and where the problem lies? Just in case: - I have also tried to use the "loose" version in the HTML code: http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd";> But it didn't change anything. - redirect_to a different :action works. Thank you for any help with this! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Injecting Ruby code into a javascript file?
Thanks a lot! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Injecting Ruby code into a javascript file?
Hi, as far as I know it's possible to inject Ruby code into javascript code if the javascript code is included in a view/page. But is this also possible when the javascript code is in a separate .js file that is located in the folder "public/javascripts"? Thanks for your help! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Can Rails I18n translate plugins ?
Hi there, can anyone tell me if it is possible for Rails' (2.3.2) I18n component to translate files *outside* of the 'app' folder (i.e. plugins in the 'vendor' folder)? Would it need any kind of "hack" or would files be translated following simply the standard procedure? Thanks! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: What does the ' %s ' mean ?
Thanks a lot! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] What does the ' %s ' mean ?
Hi there, can anyone explain to me how I have to understand the: %s in the following code line: yield :error, "There was a problem resending your activation code, please try again or %s.", "resend_activation_path" Whant does it stand for, what does it mean, what does it do? Thanks! Tom -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Does ARMailer work in Rails 2.3 ?!
Here's the solution for those of you who will encounter the same issue ("the class reloading issue"): Drop the file attached (ar_mailer_patch.rb) into you initializers folder. The file uses the explicit Email class name instead of the class variable, to create the email record. Kudos to Adam Meehan (adzap-ar_mailer) for providing the solution! Tom Attachments: http://www.ruby-forum.com/attachment/3531/ar_mailer_patch.rb -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Does ARMailer work in Rails 2.3 ?!
Ok, I will do that - thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---