Re: [Rails] getting error:undefined method 'current'
On 29 February 2012 05:22, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:31 PM, Colin Law clan...@googlemail.com wrote: On 28 February 2012 11:53, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:06 PM, Michael Pavling pavl...@gmail.com wrote: On 28 February 2012 11:26, sachin kewale sachinkew...@gmail.com wrote: i am getting an error 'undefined method 'current' for 852:Fixnum', the error coming for following line %if @expert_pagination.current.previous% and the value of @expert_pagination is what? Have you debugged it to see? I assume you expect it to be an object of some sort with a method .current; but the error is telling you that it's a Fixnum... yes the @expert_pagination is object No it is not an object, it is a number. Have a look at the Rails Guide on Debugging to get ideas on how to work out what is going on. Colin ... yes it is number ,but when the number is like 6,7 it is giving an error ''undefined method 'current' for 852:Fixnum'' I don't understand what you are saying, you accept that @expert_pagination is a number, but then expect to be able to say @expert_pagination.current. A number does not have a method current so the error is shown. What do you expect @expert_pagination.current to do if @expert_pagination is a simple number? I also don't understand what you mean by when the number is like 6,7 6,7 is not a number, or do you mean 6.7? Have you followed my earlier suggestion to read the Rails Guide on debugging in order to find out what is going on? Please answer this question if you reply, do not just ignore it. Colin -- 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.
Re: [Rails] ensuring random list of numbers are unique
On 29 February 2012 00:10, John Merlino stoici...@aol.com wrote: 500.times.map { Integer((rand * 1) * 1000) / Float(1000) } Basically, this gives me a list of 500 random decimal numbers that are rounded to 3 places. However, I also want to make sure that all are unique. This is a classic how do I achieve my solution?, rather than a here's my problem... how can I solve it post... Can we back up a second please? What are you trying to achieve with this list of 500 numbers? And what do you want to do if the list you have generated does contain duplicates? As already said, you can use the .uniq method to remove dupes - but that might leave you with an array of 496 elements... would that be a problem? Are you really asking how do I generate an array of 500 random numbers? What do you want to do with these 500 random numbers? Considering that one user could make a request and get their 500 randoms, and another user could do the same - there could be duplicates across users. Is this going to be a problem? Please try to ask clearer questions, as the way it stands, I could spend ages of my time coming up with solutions to what I *think* is your problem, just to have you say nope... that's not what I was after. Multiply that across the subscribers to this list, and you've wasted a hell of a lot of peoples' time around the world :-/ PS BTW Why are you multiplying by 1 in your example code? (and does that line even work if you paste it into your console, as it explodes for me with a LocalJumpError... but that may just be Ruby versions...) -- 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.
Re: [Rails] Re: ensuring random list of numbers are unique
On Wed, Feb 29, 2012 at 3:05 AM, Robert Walker li...@ruby-forum.com wrote: Robert Walker wrote in post #1049376: #!/usr/bin/env ruby require 'set' def random_numbers(n = 500) my_set = Set.new while my_set.size 500 value = Integer((rand * 1) * 1000) / Float(1000) my_set value end my_set.to_a end puts random_numbers.size One caveat with this technique: Make sure you build in some circuit breaker protection code. The more numbers you ask this to generate the more rounds it will take to produce the result. Generating 500 unique numbers is averaging about 700 rounds. The closer to 1000 you get the more rounds it will take. Over 1000 and it will never finish. Another caveat is that the Array contains Float objects, while the original question was 500 unique decimals. Two issues here: 1) if decimals are asked in the problem statement, why then do we serve Floats in the result? 2) The problem is that for uniqueness, we need the '==' operator and on Floats that represent fractional numbers in the decimal system, equality is not a stable function (as was discussed many times before ...). So, in all proposed solutions, I would exchange this line: value = Integer((rand * 1) * 1000) / Float(1000) with this one: value = rand(1000) / BigDecimal.new(1000) HTH, Peter -- 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 use link_to with :remote=true in rails 3.2.1
I m using Rails 3.2.1. how to use link_to with remote=true My Method in Controller def clickme @clk = you click me respond_to do |format| format.js { render :layout=false } end end My View In my new.html.erb file %= link_to click here, {:action=clickme}, {:remote = true, :id=clk} % div id=allclick %= render :partial = 'goclick' % /div _goclick.html.erb %= @clk % clickme.js.erb $(allclick).update(%= escape_javascript(render(:partial = goclick)) %); On my web-page everything is fine when I click on click here link nothing change. But when I check Firebug console it shows me: $(allclick).update(you click me); Help Me :( -- 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.
Re: [Rails] getting error:undefined method 'current'
On Wed, Feb 29, 2012 at 1:57 PM, Colin Law clan...@googlemail.com wrote: On 29 February 2012 05:22, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:31 PM, Colin Law clan...@googlemail.com wrote: On 28 February 2012 11:53, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:06 PM, Michael Pavling pavl...@gmail.com wrote: On 28 February 2012 11:26, sachin kewale sachinkew...@gmail.com wrote: i am getting an error 'undefined method 'current' for 852:Fixnum', the error coming for following line %if @expert_pagination.current.previous% and the value of @expert_pagination is what? Have you debugged it to see? I assume you expect it to be an object of some sort with a method .current; but the error is telling you that it's a Fixnum... yes the @expert_pagination is object No it is not an object, it is a number. Have a look at the Rails Guide on Debugging to get ideas on how to work out what is going on. Colin ... yes it is number ,but when the number is like 6,7 it is giving an error ''undefined method 'current' for 852:Fixnum'' I don't understand what you are saying, you accept that @expert_pagination is a number, but then expect to be able to say @expert_pagination.current. A number does not have a method current so the error is shown. What do you expect @expert_pagination.current to do if @expert_pagination is a simple number? I also don't understand what you mean by when the number is like 6,7 6,7 is not a number, or do you mean 6.7? Have you followed my earlier suggestion to read the Rails Guide on debugging in order to find out what is going on? Please answer this question if you reply, do not just ignore it. Colin -- 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. colin, i am new to ROR ,the scenario is like that if goto Url www.sugestica.com:8881 and in search on home page if searched using latest suggestions it will give me error and also i said before that the error is coming for '@book_pages.current. previous' which is getting the value from controller.i debug and found that it getting value number single digit 6 suppose . i think now you are clear what i am asking for.I just want to know the cause of this error undefined method `current' for 6:Fixnum -- sachin -- 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.
Re: [Rails] getting error:undefined method 'current'
On 29 February 2012 09:26, sachin kewale sachinkew...@gmail.com wrote: '@book_pages.current. previous' which is getting the value from controller.i debug and found that it getting value number single digit 6 suppose . i think now you are clear what i am asking for.I just want to know the cause of this error undefined method `current' for 6:Fixnum Yes, the error is (as has been said several times already) that something you think should be an object with the method .current, is actually a number 6... look at where you populate @book_pages. -- 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.
Re: [Rails] getting error:undefined method 'current'
On 29 February 2012 09:26, sachin kewale sachinkew...@gmail.com wrote: On Wed, Feb 29, 2012 at 1:57 PM, Colin Law clan...@googlemail.com wrote: On 29 February 2012 05:22, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:31 PM, Colin Law clan...@googlemail.com wrote: On 28 February 2012 11:53, sachin kewale sachinkew...@gmail.com wrote: On Tue, Feb 28, 2012 at 5:06 PM, Michael Pavling pavl...@gmail.com wrote: On 28 February 2012 11:26, sachin kewale sachinkew...@gmail.com wrote: i am getting an error 'undefined method 'current' for 852:Fixnum', the error coming for following line %if @expert_pagination.current.previous% and the value of @expert_pagination is what? Have you debugged it to see? I assume you expect it to be an object of some sort with a method .current; but the error is telling you that it's a Fixnum... yes the @expert_pagination is object No it is not an object, it is a number. Have a look at the Rails Guide on Debugging to get ideas on how to work out what is going on. Colin ... yes it is number ,but when the number is like 6,7 it is giving an error ''undefined method 'current' for 852:Fixnum'' I don't understand what you are saying, you accept that @expert_pagination is a number, but then expect to be able to say @expert_pagination.current. A number does not have a method current so the error is shown. What do you expect @expert_pagination.current to do if @expert_pagination is a simple number? I also don't understand what you mean by when the number is like 6,7 6,7 is not a number, or do you mean 6.7? Have you followed my earlier suggestion to read the Rails Guide on debugging in order to find out what is going on? Please answer this question if you reply, do not just ignore it. Colin -- 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. colin, i am new to ROR ,the scenario is like that if goto Url www.sugestica.com:8881 and in search on home page if searched using latest suggestions it will give me error and also i said before that the error is coming for '@book_pages.current. previous' which is getting the value from controller.i debug and found that it getting value number single digit 6 suppose . i think now you are clear what i am asking for.I just want to know the cause of this error undefined method `current' for 6:Fixnum The cause of the error is simple. 1. @book_pages is the number 6. 2. You have the code @book_pages.current 3. This is the same as saying 6.current 4. The number 6 does not have a method called current 5. Therefore there is the error that the method 'current' is not defined for the number 6. Now if your question is 'why is @book_pages the number 6' then you must look at the code where you setup @book_pages. I think you would be better to work through some tutorials first however. I suggest that you forget what you are doing for a few days and work right through something like railstutorial.org, which is free to use online. Then you will have a better grasp of the fundamentals of RoR and will be able to answer your own questions. Colin -- 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] Deploying to a DMZ
Currently I have been doing the usual cap deployments for a project to a test environment as my app develops. Nothing exciting, but I have now got to deploy it on a reasonable scale to a DMZ that has no access to the git repo/ or any other nice things. Anyone got 'best practice' for this situation, I can push to the DMZ using ssh/scp etc, even rsync ... but rather than a cobbled together approach, I would prefer good practice. 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.
Re: [Rails] Deploying to a DMZ
On 29 February 2012 10:42, Bert Gloan li...@ruby-forum.com wrote: Currently I have been doing the usual cap deployments for a project to a test environment as my app develops. Nothing exciting, but I have now got to deploy it on a reasonable scale to a DMZ that has no access to the git repo/ or any other nice things. Anyone got 'best practice' for this situation, I can push to the DMZ using ssh/scp etc, even rsync ... but rather than a cobbled together approach, I would prefer good practice. I use a script that touches the local tmp/restart.txt (which, for me anyway, causes the server to restart) then uses rsync to update the server then using ssh run the remote command to precompile the assets. For the actual file transfer rsync is amazingly fast (particularly if the server is remote) as the connection is only made once. If any gems have changed you will need to bundle install on the server also, but I do this manually if required. Also if migrations have been added then you will need to run the migrations. For the rsync I have an ignore file containing: .git .gitignore .rvmrc .bundle doc log db/schema.rb tmp/cache tmp/pids tmp/sesssions tmp/sockets tmp/markup test spec public/javascripts/all.js public/assets vendor/bundle .bundle/config I too will be interested to hear of other suggestions. Colin -- 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.
Re: [Rails] Deploying to a DMZ
On Wed, Feb 29, 2012 at 12:06 PM, Colin Law clan...@googlemail.com wrote: On 29 February 2012 10:42, Bert Gloan li...@ruby-forum.com wrote: Currently I have been doing the usual cap deployments for a project to a test environment as my app develops. Nothing exciting, but I have now got to deploy it on a reasonable scale to a DMZ that has no access to the git repo/ or any other nice things. Anyone got 'best practice' for this situation, I can push to the DMZ using ssh/scp etc, even rsync ... but rather than a cobbled together approach, I would prefer good practice. I use a script that touches the local tmp/restart.txt (which, for me anyway, causes the server to restart) then uses rsync to update the server then using ssh run the remote command to precompile the assets. For the actual file transfer rsync is amazingly fast (particularly if the server is remote) as the connection is only made once. If any gems have changed you will need to bundle install on the server also, but I do this manually if required. Also if migrations have been added then you will need to run the migrations. For the rsync I have an ignore file containing: .git .gitignore .rvmrc .bundle doc log db/schema.rb tmp/cache tmp/pids tmp/sesssions tmp/sockets tmp/markup test spec public/javascripts/all.js public/assets vendor/bundle .bundle/config I too will be interested to hear of other suggestions. If I understand correctly, the root problem of the OP is not being able to use standard capistrano recipes since the production server (in the DMZ) cannot reach the git repo that is inside the company firewall? What I have done in such a scenario (where my production server is at a hosting company) is to use standard capistrano practice, but have a production branch of the git repo on the production server. So the `git checkout` on the production server is pulling from a local repo. The top of my deploy.rb then becomes something like: set :user, 'vandenabeele' # username on the production server set :application, 'flamjobs' # app name set :repository, 'vandenabe...@xxx.yyy.zz:git/flamjobs.git' set :branch, 'production' For that, I has set-up a bare repository in the directory /home/vandenabeele/git/flamjobs.git and I push into that from my dev machine before running cap deploy (I could probably automate that too ...). HTH, Peter -- 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 use link_to with :remote=true in rails 3.2.1
You probably want to use $(#allclick).update instead of $(allclick).update Note the # that indicates you are selecting an element by the ID. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vwmay5y73OwJ. 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 use link_to with :remote=true in rails 3.2.1
Tim Shaffer wrote in post #1049440: You probably want to use $(#allclick).update instead of $(allclick).update Note the # that indicates you are selecting an element by the ID. I'm using $(#allclick).update -- 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: If photo field blank then?
Walter Davis wrote in post #1049293: On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: the users. td align = center%= link_to Show, user %/body /tbody % end % For the following line I want to do something like this: If user has photo %- if user.photo.url? -% td align = center%= image_tag user.photo.url, :height = 50, :width = 50 %/td else display this photo %= image_tag 'generic_avatar.png' % end How would I go about doing this? Ideally, you would extract this into a helper method, since you don't want to be repeating all that conditional logic all over the place. Then you could simply call the 'avatar' method: #users_helper.rb def avatar(user) if user.photo.url? raw image_tag(user.photo.url) else raw image_tag('generic_avatar.png') end end Untested, but it ought to work. Walter Hey Walter, I placed the above in my user helper and my application helper but no luck It doesn't change anything. I even changed the above to def photo(user) I tried changing my index.html bit from what it is to image_tag photo.url(user) but that caused an error. I am not sure now, I tried using the old code I had for gravatar but that doesn't do anything. Thanks Christopher Jones -- 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] Passing params to :delete
Hi, I'm new to Rails, and I'd like to be able to redirect from methods in my Controller, based on the page I've come from. I know I can do: %= link_to 'Show', event_path(@event, :from = 'page1') % and :from will be passed to params, and I can redirect based on this on my Controller. I have a few quesetions. Firstly, is this a good idea? Is there a better way of doing it? Secondly, how can I achieve this with the :delete method? It uses slightly different syntax, as far as I'm aware. %= link_to 'Delete', @event, :method = :delete % Thirdly, how can I achieve this with the edit action? My edit currently looks like this: def edit @event = Event.find(params[:id]) end And it renders a form, which I assume goes to the update action. So how can I get the param[:form] from 'edit' through the form into 'update'? Thanks, Fraser -- 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.
Re: [Rails] Re: If photo field blank then?
On 29 February 2012 13:47, Christopher Jones li...@ruby-forum.com wrote: Walter Davis wrote in post #1049293: On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: the users. td align = center%= link_to Show, user %/body /tbody % end % For the following line I want to do something like this: If user has photo %- if user.photo.url? -% td align = center%= image_tag user.photo.url, :height = 50, :width = 50 %/td else display this photo %= image_tag 'generic_avatar.png' % end How would I go about doing this? Ideally, you would extract this into a helper method, since you don't want to be repeating all that conditional logic all over the place. Then you could simply call the 'avatar' method: #users_helper.rb def avatar(user) if user.photo.url? raw image_tag(user.photo.url) else raw image_tag('generic_avatar.png') end end Untested, but it ought to work. Walter Hey Walter, I placed the above in my user helper and my application helper but no luck It doesn't change anything. I even changed the above to def photo(user) I tried changing my index.html bit from what it is to image_tag photo.url(user) but that caused an error. I am not sure now, I tried using the old code I had for gravatar but that doesn't do anything. I think my suggestion was better. If you can put something in the model it is generally better than in a helper. But to use Walter's method, did you change the code in the view to use the helper method? Colin -- 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.
Re: [Rails] Re: If photo field blank then?
On Feb 29, 2012, at 8:47 AM, Christopher Jones wrote: Walter Davis wrote in post #1049293: On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: the users. td align = center%= link_to Show, user %/body /tbody % end % For the following line I want to do something like this: If user has photo %- if user.photo.url? -% td align = center%= image_tag user.photo.url, :height = 50, :width = 50 %/td else display this photo %= image_tag 'generic_avatar.png' % end How would I go about doing this? Ideally, you would extract this into a helper method, since you don't want to be repeating all that conditional logic all over the place. Then you could simply call the 'avatar' method: #users_helper.rb def avatar(user) if user.photo.url? raw image_tag(user.photo.url) else raw image_tag('generic_avatar.png') end end Untested, but it ought to work. Walter Hey Walter, I placed the above in my user helper and my application helper but no luck It doesn't change anything. I even changed the above to def photo(user) I tried changing my index.html bit from what it is to image_tag photo.url(user) but that caused an error. IF you created the helper method I posted earlier, you would want to replace your entire image tag code in your index.html with %= avatar(user) % But I like Colin's idea even better, since it separates concerns more neatly. #models/user.rb ... def user_photo (photo.url?) ? photo.url : 'default.png' end And then in index.html.erb: %= image_tag user.user_photo % Much cleaner that way, since you don't have to look in the helper for the HTML or the accessor logic, rather you look for HTML in the view and logic in the model, as Rails intends. Walter I am not sure now, I tried using the old code I had for gravatar but that doesn't do anything. Thanks Christopher Jones -- 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. -- 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: JIRA anyone?
Tom Allison wrote in post #1049289: So my next question is -- does anyone use JIRA API with Ruby/Rails and if so -- how? I'm guessing, not very many. I attend the Ruby user's group whenever I can. I've not seen or heard of anyone using JIRA with Rails. Most prefer a more agile project management tool such as PivotalTracker, Lighthouse or similar. Each of these have REST based APIs and are often integrated with Rails. I'm really surprised at the complete lack of mention in the last 2 years and am wondering if I made a mistake picking Jira up as a potential solution for my business. I'm not surprised about this. JIRA is an Enterprisy project management tool. While Ruby on Rails is perhaps gaining some ground in the enterprise space it's not something necessarily driven by the core Rubyists. Rails is well known to be an opinionated framework. And SOAP lost that battle years ago to REST. So I'm not surprised to see little mention, or support, of a SOAP based API no matter what's sitting on the other side of it. I'm not saying that your choice of JIRA was a mistake. I've not evaluated the software, mostly because my first glance at it didn't appeal me. And, finding out now that its API is based on SOAP just lowered my interest even further. I did evaluate a lot of project management/tracking solutions and found only one that I was actually happy with, which is PivotalTracker. That's not to say it's the solution for everyone though. As for helping you with your soap4r/JIRA integration problem. I'm not surprised your having trouble, but I have no idea how to help you with that. I do wish you luck in fining a solution. -- 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.
Re: [Rails] Re: Ruby IDEs
+1 for RubyMine. Everything is at your fingertips, and the debugging is great. I keep discovering new features that speed up development. On Tue, Feb 28, 2012 at 9:20 PM, soldier.coder geekprogrammer...@googlemail.com wrote: First: Free your mind from the shackle that comes from false belief that IDE's are necessary for superior productivity. IDE's are great for compiledh languages like C or C++ as they can spot syntax errors that will cause your program to not compile. Instead, embrace Behavior Driven Development, write tests for code you haven't written yet, tests for code you have written, consider how to refactor the code that results. Move faster by going slower! Learn to wield your editor like a samurai's sword -- an extension of yourself. From Agile Web Development with Rails: It may surprise you to know that most Rails [and Ruby] developers don't use fully fledged IDE's for Ruby or Rails (although some of the environments come close). Indeed many Rails developers use plain old editors. And it turns out that this isn't as much of a problem as you might think. With other less expressive languages, programmers rely on IDEs to do much of the grunt work for them, because IDE's do code generation, assist with navigation, and compile incrementally to give early warning of errors. With Ruby, however, much of this support just isn't necessary. Editors such as Textmate and BBEdit [or E for Windows, or VIM for Linux] give you 90 percent of what you'd get from and IDE but are far lighter weight. Just about the only useful IDE facility that's missing is refactoring support. SC On Feb 28, 9:46 am, nada nn.r...@gmail.com wrote: Hi, I'm a novice in Ruby , I want to ask what is the best IDEs to use Ruby for beginners ? Is eclipse a good choice ? any idea? Thanks a lot! Nada -- 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. -- 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] routes issues with rails3
Here i am using *rails3*, here the view.html.erb form have one login button, so when i click on that button, gives no routes matches :controller = 'home', :action = 'login'. But i have put that in routes.rb. Why this happening? *view.html.erb* %= form_tag( { :controller = 'home', :action = 'login' }, { :method = 'post'}) do % %= text_field(:name, :name, :class = span2,:placeholder = Username) % %= password_field_tag(:password, :password, :class =span2) % %= submit_tag Login, :class = btn btn-primary % % end % routes.rb resources :home do post :login, :on = :member end homecontroller.rb class HomeController ApplicationController def login end end -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/dwIdjTTKPmwJ. 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: If photo field blank then?
#models/user.rb ... def user_photo (photo.url?) ? photo.url : 'default.png' end And then in index.html.erb: %= image_tag user.user_photo % Hi, I done the above but I get the following error: undefined method `url?' for /photos/original/missing.png:Paperclip::Attachment Any ideas why this? must I change it to photo.url.present? 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.
Re: [Rails] JIRA anyone?
Greenhopper is a Jira plugin for Scrum teams - Pivotal Tracker, Rally and others get better reviews from users I have heard from. Where I work we do a lot of Jira automation using the SOAP listener, both with ruby and java - I have used jira4r (I posted a gemspec for it on the Atlassian site if I am remembering correctly) - I think the error you are getting means you do not have a supported XML processor installed ... All the gem does is if I remember correctly is store the session key returned from login in an instance variable and then add that parameter to every outgoing request that is made - it is pretty tiny code-wise. Max On 2/29/12, Robert Walker li...@ruby-forum.com wrote: Tom Allison wrote in post #1049289: So my next question is -- does anyone use JIRA API with Ruby/Rails and if so -- how? I'm guessing, not very many. I attend the Ruby user's group whenever I can. I've not seen or heard of anyone using JIRA with Rails. Most prefer a more agile project management tool such as PivotalTracker, Lighthouse or similar. Each of these have REST based APIs and are often integrated with Rails. I'm really surprised at the complete lack of mention in the last 2 years and am wondering if I made a mistake picking Jira up as a potential solution for my business. I'm not surprised about this. JIRA is an Enterprisy project management tool. While Ruby on Rails is perhaps gaining some ground in the enterprise space it's not something necessarily driven by the core Rubyists. Rails is well known to be an opinionated framework. And SOAP lost that battle years ago to REST. So I'm not surprised to see little mention, or support, of a SOAP based API no matter what's sitting on the other side of it. I'm not saying that your choice of JIRA was a mistake. I've not evaluated the software, mostly because my first glance at it didn't appeal me. And, finding out now that its API is based on SOAP just lowered my interest even further. I did evaluate a lot of project management/tracking solutions and found only one that I was actually happy with, which is PivotalTracker. That's not to say it's the solution for everyone though. As for helping you with your soap4r/JIRA integration problem. I'm not surprised your having trouble, but I have no idea how to help you with that. I do wish you luck in fining a solution. -- 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. -- 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.
Re: [Rails] Re: Re: If photo field blank then?
On Feb 29, 2012, at 9:20 AM, Christopher Jones wrote: #models/user.rb ... def user_photo (photo.url?) ? photo.url : 'default.png' end And then in index.html.erb: %= image_tag user.user_photo % Hi, I done the above but I get the following error: undefined method `url?' for /photos/original/missing.png:Paperclip::Attachment Any ideas why this? must I change it to photo.url.present? Yes, or maybe photo.url.blank? or just photo.url (without the question mark) would work. Walter 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. -- 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.
Re: [Rails] Ruby IDEs
Tmux + tmuxinator + vim + Janus (bundle of really useful vim plugins for ruby developers) - just started using this combo and it is great - lets you easily build your own very powerful IDE. Max On 2/29/12, Paul p...@nines.org wrote: +1 for RubyMine. Everything is at your fingertips, and the debugging is great. I keep discovering new features that speed up development. On Tue, Feb 28, 2012 at 9:20 PM, soldier.coder geekprogrammer...@googlemail.com wrote: First: Free your mind from the shackle that comes from false belief that IDE's are necessary for superior productivity. IDE's are great for compiledh languages like C or C++ as they can spot syntax errors that will cause your program to not compile. Instead, embrace Behavior Driven Development, write tests for code you haven't written yet, tests for code you have written, consider how to refactor the code that results. Move faster by going slower! Learn to wield your editor like a samurai's sword -- an extension of yourself. From Agile Web Development with Rails: It may surprise you to know that most Rails [and Ruby] developers don't use fully fledged IDE's for Ruby or Rails (although some of the environments come close). Indeed many Rails developers use plain old editors. And it turns out that this isn't as much of a problem as you might think. With other less expressive languages, programmers rely on IDEs to do much of the grunt work for them, because IDE's do code generation, assist with navigation, and compile incrementally to give early warning of errors. With Ruby, however, much of this support just isn't necessary. Editors such as Textmate and BBEdit [or E for Windows, or VIM for Linux] give you 90 percent of what you'd get from and IDE but are far lighter weight. Just about the only useful IDE facility that's missing is refactoring support. SC On Feb 28, 9:46 am, nada nn.r...@gmail.com wrote: Hi, I'm a novice in Ruby , I want to ask what is the best IDEs to use Ruby for beginners ? Is eclipse a good choice ? any idea? Thanks a lot! Nada -- 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. -- 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. -- 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: Re: If photo field blank then?
Walter Davis wrote in post #1049458: On Feb 29, 2012, at 9:20 AM, Christopher Jones wrote: Hi, I done the above but I get the following error: undefined method `url?' for /photos/original/missing.png:Paperclip::Attachment Any ideas why this? must I change it to photo.url.present? Yes, or maybe photo.url.blank? or just photo.url (without the question mark) would work. Walter Hey Walter. If I put the line: (photo.url.blank?) ? photo.url : 'images/guest.png' They all display the guest image, even those users who have a display picture. If I put the line: (photo.url.present?) ? photo.url : '/images/guest.png' The users who have images have their photos displayed but those who don't get a blank image. 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-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: routes issues with rails3
You should define it as :on = :collection Problem is you defined it as :member, so it expects an id to be passed, so the expected url would look like /home/:id/login Hope this helps! On 29 feb, 15:14, amvis vgrkrish...@gmail.com wrote: Here i am using *rails3*, here the view.html.erb form have one login button, so when i click on that button, gives no routes matches :controller = 'home', :action = 'login'. But i have put that in routes.rb. Why this happening? *view.html.erb* %= form_tag( { :controller = 'home', :action = 'login' }, { :method = 'post'}) do % %= text_field(:name, :name, :class = span2,:placeholder = Username) % %= password_field_tag(:password, :password, :class =span2) % %= submit_tag Login, :class = btn btn-primary % % end % routes.rb resources :home do post :login, :on = :member end homecontroller.rb class HomeController ApplicationController def login end end -- 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.
Re: [Rails] Re: Re: Re: If photo field blank then?
On Feb 29, 2012, at 9:38 AM, Christopher Jones wrote: Walter Davis wrote in post #1049458: On Feb 29, 2012, at 9:20 AM, Christopher Jones wrote: Hi, I done the above but I get the following error: undefined method `url?' for /photos/original/missing.png:Paperclip::Attachment Any ideas why this? must I change it to photo.url.present? Yes, or maybe photo.url.blank? or just photo.url (without the question mark) would work. Walter Hey Walter. If I put the line: (photo.url.blank?) ? photo.url : 'images/guest.png' They all display the guest image, even those users who have a display picture. If I put the line: (photo.url.present?) ? photo.url : '/images/guest.png' The users who have images have their photos displayed but those who don't get a blank image. Any ideas? Unless you have a sub-folder named images inside your images folder, you need to just pass guest.png to the image_tag helper (it already assumes that your pictures are in the images folder). Walter -- 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] group validation
hi im new in rails and starting to develop my application which is a online reservation im just wondering if there is a way in Ruby on rails to group a validation ei. i want to validate the uniqueness of date first in the database and check what are the timeStart and endTime entries in that particular date and validate its uniqueness(timeStart and endTime) base on the date? is it possible in validation or do i have to make a controller or method for it? to sum up my application can book a reservation in a same date but not in a same date and time sorry for my bad english my Reservation database is: 0 id INTEGER 1 1 1 lname varchar(25 1 0 2 fname varchar(25 1 0 3 contactnum integer 1 0 4 email varchar(10 1 0 5 datedate1 '2012-03-0 0 6 timeStart time1 '--- :hour 0 7 timeEnd time1 '--- :hour 0 8 numGuestinteger 0 5 0 9 totalCost decimal(2) 0 0 10 confirm boolean 0 'f' 0 11 created_at datetime0 0 12 updated_at datetime0 0 -- 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: If photo field blank then?
I have had no luck :( I have got the following in my model def user_photo (photo.url.present?) ? photo.url : 'guest.png' #tried with just photo.url end and the following my in index %= image_tag user.user_photo, :height = 50, :width = 50 % I don't know what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Thanks Christopher Jones -- 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: group validation
ei. i want to validate the presence of date first in the database and check what are the timeStart and endTime entries in that particular date and validate its uniqueness(timeStart and endTime) base on the date? is it possible in validation or do i have to make a controller or method for it? ** edit ** -- 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.
Re: [Rails] group validation
On Wed, Feb 29, 2012 at 3:53 PM, LED leedap...@gmail.com wrote: hi im new in rails and starting to develop my application which is a online reservation im just wondering if there is a way in Ruby on rails to group a validation ei. i want to validate the uniqueness of date first in the database and check what are the timeStart and endTime entries in that particular date and validate its uniqueness(timeStart and endTime) base on the date? is it possible in validation or do i have to make a controller or method for it? to sum up my application can book a reservation in a same date but not in a same date and time sorry for my bad english my Reservation database is: 0 id INTEGER 1 1 1 lname varchar(25 1 0 2 fname varchar(25 1 0 3 contactnum integer 1 0 4 email varchar(10 1 0 5 datedate1 '2012-03-0 0 6 timeStart time1 '--- :hour 0 7 timeEnd time1 '--- :hour 0 8 numGuestinteger 0 5 0 9 totalCost decimal(2) 0 0 10 confirm boolean 0 'f' 0 11 created_at datetime0 0 12 updated_at datetime0 0 1) Check the rails guide on validations http://guides.rubyonrails.org/active_record_validations_callbacks.html section 3.10 The part on scope might be helpful (e.g. uniqueness on a timeStart, scoped to date) 2) This validaton (or any validation that is outside of the db) can still fail when 2 separate processes (e.g. 2 Passenger processes) are checking at the same time (a race condition). Read e.g. the section Concurrency and integrity in http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of If you are building a serious reservation system and you do never ever want to promise the same resource to 2 different users at the same timeslot, you better understand that problem. 3) If your timeStart and endTime are intended as times in a day and not an absolute time in history, you might use my 'relativity' gem https://github.com/petervandenabeele/relativity It also has a DayTimeRange that may be useful for what you are trying to do. If you use a standardized separator you could even write an equality or overlap comparator for DayTimeRange class. HTH, Peter -- 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.
Re: [Rails] Re: If photo field blank then?
On Feb 29, 2012, at 10:04 AM, Christopher Jones wrote: I have had no luck :( I have got the following in my model def user_photo (photo.url.present?) ? photo.url : 'guest.png' #tried with just photo.url end and the following my in index %= image_tag user.user_photo, :height = 50, :width = 50 % I don't know what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Could you put just this in your view (replacing your current image tag): %= user.user_photo % And see what prints out in the browser. My guess is that it will be something, but I don't know what that is. Also, are you seeing any errors in the console when you test this locally? Walter Thanks Christopher Jones -- 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. -- 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.
Re: [Rails] Re: If photo field blank then?
On 29 February 2012 15:04, Christopher Jones li...@ruby-forum.com wrote: I have had no luck :( I have got the following in my model def user_photo (photo.url.present?) ? photo.url : 'guest.png' #tried with just photo.url end and the following my in index %= image_tag user.user_photo, :height = 50, :width = 50 % I don't know what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Use rails console to work out what is going on. In the console 'find' a record with no url and then you can call your method and see what it returns, also you can call photo.url.present? and so on to see what they give. Colin -- 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: If photo field blank then?
Walter Davis wrote in post #1049473: On Feb 29, 2012, at 10:04 AM, Christopher Jones wrote: %= image_tag user.user_photo, :height = 50, :width = 50 % I don't know what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Could you put just this in your view (replacing your current image tag): %= user.user_photo % And see what prints out in the browser. My guess is that it will be something, but I don't know what that is. Also, are you seeing any errors in the console when you test this locally? Walter Hey Walter, good shout. I just checked my console and I see this for the images section for those users who don't have an image: Started GET /photos/original/missing.png for 127.0.0.1 at 2012-02-29 15:29:16 + ActionController::RoutingError (No route matches [GET] /photos/original/missing.png): I don't know where it is getting that line from. 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.
Re: [Rails] group validation
On 29 February 2012 14:53, LED leedap...@gmail.com wrote: hi im new in rails and starting to develop my application which is a online reservation im just wondering if there is a way in Ruby on rails to group a validation ei. i want to validate the uniqueness of date first in the database and check what are the timeStart and endTime entries in that particular date and validate its uniqueness(timeStart and endTime) base on the date? is it possible in validation or do i have to make a controller or method for it? You might be better to use datetime column types rather than a separate date and time. Then you will just need to check the uniqueness of the datetime values. You can easily then extract the date and time separately for display purposes. Colin -- 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] requery using join
I make 2 queries. - The first: @queue = Attempt.joins({:problem_info = [:problem, :contest]}, :user).where('contests.id' = 1).limit(100) - The second: queue = ActiveRecord::Base.connection.query( SELECT pi.number, p.name \pname\, u.name, a.result, a.exec_time, a.used_memory, a.time - c.start_time \time\ FROM attempts a INNER JOIN problem_infos pi ON (pi.id = a.problem_info_id) INNER JOIN problems p ON (p.id = pi.problem_id) INNER JOIN users u ON (u.id = a.user_id) INNER JOIN contests c ON (c.id = pi.contest_id) WHERE (pi.contest_id = 1) ORDER BY a.time DESC;) --- The first query is better and it is write easy, but it makes several small requery to database. If i am right, i use resources of Ruby on Rails. The seond query make one requery to database. I want to use the first query, but it works longer than the second. How to right query, using join, but it mustn't make several requery. -- 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.
Re: [Rails] Re: Re: If photo field blank then?
On Feb 29, 2012, at 10:31 AM, Christopher Jones wrote: Walter Davis wrote in post #1049473: On Feb 29, 2012, at 10:04 AM, Christopher Jones wrote: %= image_tag user.user_photo, :height = 50, :width = 50 % I don't know what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Could you put just this in your view (replacing your current image tag): %= user.user_photo % And see what prints out in the browser. My guess is that it will be something, but I don't know what that is. Also, are you seeing any errors in the console when you test this locally? Walter Hey Walter, good shout. I just checked my console and I see this for the images section for those users who don't have an image: Started GET /photos/original/missing.png for 127.0.0.1 at 2012-02-29 15:29:16 + ActionController::RoutingError (No route matches [GET] /photos/original/missing.png): I don't know where it is getting that line from. Aha! That is coming from deep in the heart of Paperclip. You have two options. First, put your missing icon image at that path in your application. Second, choose a different method to test on your model. Instead of using the image accessor, look for one of the actual database columns in your model. (Look in db/schema.rb at your column names, pick something like photo_file_name or the local equivalent.) Then make the test in the method something to match: (user.photo_file_name?) ? photo.url : 'default.png' The problem, as I should have picked up on from your earlier mention of the missing photo never appearing, is that photo.url always returns *something*, so it's not a good test subject for the ternary operator. Walter 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. -- 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: Re: If photo field blank then?
Walter Davis wrote in post #1049480: On Feb 29, 2012, at 10:31 AM, Christopher Jones wrote: Hey Walter, good shout. I don't know where it is getting that line from. Aha! That is coming from deep in the heart of Paperclip. You have two options. First, put your missing icon image at that path in your application. Second, choose a different method to test on your model. Instead of using the image accessor, look for one of the actual database columns in your model. (Look in db/schema.rb at your column names, pick something like photo_file_name or the local equivalent.) Then make the test in the method something to match: (user.photo_file_name?) ? photo.url : 'default.png' The problem, as I should have picked up on from your earlier mention of the missing photo never appearing, is that photo.url always returns *something*, so it's not a good test subject for the ternary operator. Walter Fixed it, I simply added default_url : guest.png to my has_attached_file :photo model method. -- 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] Accessing raw cookie values?
Hi there, I realized today that rails does some automatic (url?) decoding of cookie values. I assume it is because if you set a cookie, the value is also url encoded. The problem is that the cookie specification does not seem to specify the need of encoding. Thus, if an external application sets a cookie (e.g. a domain cookie where apps are on multiple subdomains) it can happen that it is decoded although it was not encoded. A simple example is that a non-encoded cookie containing a+b results in the ruby string a b when accessed in Rails. I wanted to ask if anyone knows any details about this behavior or if it is possible to access the raw string? Thanks a lot, Christoph -- 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.
Re: [Rails] Re: Re: Re: If photo field blank then?
On Feb 29, 2012, at 10:45 AM, Christopher Jones wrote: Walter Davis wrote in post #1049480: On Feb 29, 2012, at 10:31 AM, Christopher Jones wrote: Hey Walter, good shout. I don't know where it is getting that line from. Aha! That is coming from deep in the heart of Paperclip. You have two options. First, put your missing icon image at that path in your application. Second, choose a different method to test on your model. Instead of using the image accessor, look for one of the actual database columns in your model. (Look in db/schema.rb at your column names, pick something like photo_file_name or the local equivalent.) Then make the test in the method something to match: (user.photo_file_name?) ? photo.url : 'default.png' The problem, as I should have picked up on from your earlier mention of the missing photo never appearing, is that photo.url always returns *something*, so it's not a good test subject for the ternary operator. Walter Fixed it, I simply added default_url : guest.png to my has_attached_file :photo model method. Good one. Then you can also remove the whole custom accessor method, because any request of photo.url will always return something useful now. Just go back to where you started, with image_tag user.photo.url. Walter -- 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: group validation
3) If your timeStart and endTime are intended as times in a day and not an absolute time in history, you might use my 'relativity' gem https://github.com/petervandenabeele/relativity It also has a DayTimeRange that may be useful for what you are trying to do. If you use a standardized separator you could even write an equality or overlap comparator for DayTimeRange class. HTH, Peter thank you it help me alot more power to us all -- 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: Deploying to a DMZ
yes - I have thought of similar things, but just to clarify: I cannot do a git pull from the DMZ inside the firewall as a deployment method, I cannot compile locally on the DMZ machine, my test target is the same OS as the test/dev envs, so compiled assets will work when transferred directly. The 'production branched' local repo may be my best approach though ... I just think that others must have encountered this problem. Was always surprised that cap didnt have some kind of push approach. -- 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.
Re: [Rails] Re: Deploying to a DMZ
On 29 Feb 2012, at 17:33, Bert Gloan wrote: yes - I have thought of similar things, but just to clarify: I cannot do a git pull from the DMZ inside the firewall as a deployment method, I cannot compile locally on the DMZ machine, my test target is the same OS as the test/dev envs, so compiled assets will work when transferred directly. The 'production branched' local repo may be my best approach though ... I just think that others must have encountered this problem. Was always surprised that cap didnt have some kind of push approach. It actually does or at least did: https://groups.google.com/group/capistrano/browse_thread/thread/d00a703c99353567/642026e315d64461?hl=en Best regards Peter De Berdt -- 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] customise the color of link_to text
I have a section of link to button's in my index that have associated CSS which has a black background. Despite me in the css specifying the text to be the color white it is staying just plain black. How would I go about applying my own color to a link_to. My index section is as followed: div id=table-3 table width=1160 thead th%= link_to 'Playstation 3', games_path(:console = 'Playstation 3')%/th . /thead /table /div and a section of my css #table-3 th { font-size: 12px; font-weight: normal; color: #FF; line-height: 40px; margin-bottom: 10px; font-weight: normal; text-align: center; } 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: customise the color of link_to text
Well a link_to creates a regular link in HTML so you need to style the a tag. #table-3 th a { color: . } Or if you want to style both regular text and links in that part: #table-3 th, #table-3 th a { color: ... } Den onsdagen den 29:e februari 2012 kl. 19:16:51 UTC+1 skrev Ruby-Forum.com User: I have a section of link to button's in my index that have associated CSS which has a black background. Despite me in the css specifying the text to be the color white it is staying just plain black. How would I go about applying my own color to a link_to. My index section is as followed: div id=table-3 table width=1160 thead th%= link_to 'Playstation 3', games_path(:console = 'Playstation 3')%/th . /thead /table /div and a section of my css #table-3 th { font-size: 12px; font-weight: normal; color: #FF; line-height: 40px; margin-bottom: 10px; font-weight: normal; text-align: center; } 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/AJRRRKsKhMYJ. 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.
Re: [Rails] rails and javascript
On Tue, Feb 28, 2012 at 16:50, Dev Guy devguy...@gmail.com wrote: I want to add a dropdown selection box that when an item is selected a javascript function gets called, is there an easy way to do this with Rails? Sure, though it's not Rails-specific; just use the onchange attribute. See: http://www.w3schools.com/jsref/event_onchange.asp for an intro to the concept. -Dave -- Dave Aronson: Available Cleared Ruby on Rails Freelancer (NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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] OpenSSL on rails 2
Hi list, It's been a while since I looked at rails and I am a but rusty. I'm looking for a nudge in the right direction if anyone would be so kind to help me. I'm looking at something I did a few years back that I need to review and upgrade. The last time I looked at this we were on Rails 2.0.2 so that's what this code is for. So I am trying to get it running on that environment to start off. I have a RVM environment running rails 2.0.2 on ruby 1.8.7. I can run my application but I get an error like the below. wrong argument type Class (expected Module) Application Trace | Framework Trace | Full Trace lib/mymodule.rb:65:in `include' lib/mymodule.rb:65 app/controllers/application.rb:8 The code snippet referred to is a module of the form: 60 module Mymodule 61 62 require 'openssl' 63 include OpenSSL 64 include PKey 65 include Cipher So I suspect I have something wrong with my OpenSSL in rvm, but I don't know what. This code worked fine the last time I looked at it. The module is mixed in to a controller. I tried the below to test if openssl is available: $ ruby -ropenssl -e puts :Hello Hello I would appreciate any pointers I can get to help me get started... -- 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.
Re: [Rails] how to pre-select a collection_select inside a form_for?
http://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/collection_select might help you on this. It seems to depend on what exact objects you've got set up. I'm not too clear on it myself! -Dave -- Dave Aronson: Available Cleared Ruby on Rails Freelancer (NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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] link_to alphabetical search
Hi all, I have a link_to method in rails for each letter of the alphabet (early days yet, will put it in a loop later). I have the same for a console on another page and that one works fine but the one on my page for the letters does not. I have the following in my model: def index user_relation = case params[:username].present? when true then User.where(:username = params[:username]) else User end @users = user_relation.paginate :page=params[:page], :order = 'created_at desc', :per_page = 10 end and this is an example in my index: %= link_to 'A', users_path(:username = 'A'), {:style='color:#FF', :class = tabel-3}% Now if I click on A it does not return any results despite there being many users with the letter A but if I was to for example put in the brackets the name AdrianShaw (one of the users in my database) and click A it would return that exact user. What it seems to be doing is search but only for exact match results, anything less than the full word and it does not return. How would I go about doing this so that it gets all users with the first letter A and so on? Thanks Christopher Jones -- 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: OpenSSL on rails 2
On Feb 29, 5:30 pm, John Lane li...@ruby-forum.com wrote: Hi list, wrong argument type Class (expected Module) Application Trace | Framework Trace | Full Trace lib/mymodule.rb:65:in `include' lib/mymodule.rb:65 app/controllers/application.rb:8 The code snippet referred to is a module of the form: 60 module Mymodule 61 62 require 'openssl' 63 include OpenSSL 64 include PKey 65 include Cipher So I suspect I have something wrong with my OpenSSL in rvm, but I don't know what. require openssl = true module Foo | include OpenSSL::Cipher | end TypeError: wrong argument type Class (expected Module) (ripl):5:in `include' (ripl):5:in `module:Foo' (ripl):4:in `main' You're trying to include a class into a module, OpenSSL::Cipher is a class while PKey and OpenSSL itself is a module. -- Luis Lavena -- 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: OpenSSL on rails 2
Yeah but I am sure this did work before. It's been on a web site for quite some time and has been working. If what you're saying is right then I'll have to look to see if somehow my sources have been broken... -- 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] setting up a vps for rails: looking for advice, tutorials, etc.
i am trying to learn how to setup and maintain a vps for some rails apps. i have used shared and managed hosting but now i am looking for the freedom and flexibility a vps offers. i signed up with linode to give me something to play around with until i feel comfortable to deploy my live apps to a vps. i want to learn best practices and how to do things right. initially i plan on hosting only a few smaller rails apps, but hopefully more in the future. i have searched google and read quite a bit, but was wondering if any of the rails professionals could point me in the direction of some good resources or give their input directly? i have also read through many of the stackscripts and some seem good, others don't even setup a firewall. here are some of the questions that have been going through my head that i have been trying to figure out. security -all rails apps under one user or separate user for each app? -is it necessary to change the ssh port? -how insecure is keeping ssh passwords enabled? -fail2ban? keeping the software up to date -apt will help keep the os and some apps up to date -how to easily keep compiled software updated like nginx? -how about ruby, gems, rails,... which of the following is better for rails apps which linux distro? 32bit vs 64bit? iptables vs ufw? apache vs nginx? mysql vs postgresql? passenger vs unicorn? is it a good or bad idea to use rvm on a server? rvm per user or system wide? what are some good strategies for backing up the server in case of failure? how do you monitor the resource usage to see if more ram or cpu is needed? how much of what do you log and how do you monitor the logs? thank you, scott -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/1j35DMuUFUAJ. 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] Do I need WEBrick?
Hello, I started a class on RoR, and the instructor is using WEBrick, which he says ships with Rails. Is that still true? I've followed all the other instructions, I believe, and I'm not getting good messages when I type rails server . Instead I get joelrwesley$ rails server /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/ mysql2.rb:9:in `require': dlopen(/Users/joelrwesley/.rvm/gems/ ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/ mysql2-0.3.11/lib/mysql2/mysql2.bundle Reason: image not found - /Users/joelrwesley/.rvm/gems/ruby-1.9.3- p125/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/ lib/mysql2.rb:9:in `top (required)' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:68:in `require' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:66:in `each' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:66:in `block in require' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:55:in `each' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler/runtime.rb:55:in `require' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.0.22/ lib/bundler.rb:122:in `require' from /Users/joelrwesley/Desktop/Sites/simple_cms/config/ application.rb:7:in `top (required)' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/ lib/rails/commands.rb:53:in `require' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/ lib/rails/commands.rb:53:in `block in top (required)' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/ lib/rails/commands.rb:50:in `tap' from /Users/joelrwesley/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/ lib/rails/commands.rb:50:in `top (required)' from script/rails:6:in `require' from script/rails:6:in `main' joelrwesley$ Thanks, Joel -- 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.
Re: [Rails] Do I need WEBrick?
On Wed, Feb 29, 2012 at 6:48 PM, Joel joel.wes...@gmail.com wrote: Hello, I started a class on RoR, and the instructor is using WEBrick, which he says ships with Rails. Is that still true? I've followed all the other instructions, I believe, and I'm not getting good messages when I type rails server . Instead I get Did you start with 'bundle install'? If then also read this post http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serv -- Greg Akins http://twitter.com/akinsgre -- 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: ensuring random list of numbers are unique
thanks for responses, the ultimate goal was just to ensure a list of 500 (no more or less) unique random decimals that are 3 places which would be generated only one time. Currently Im storing them as a float in the mysql database. -- 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: Do I need WEBrick?
Joel wrote in post #1049544: Hello, I started a class on RoR, and the instructor is using WEBrick, which he says ships with Rails. Is that still true? I've followed all the other instructions, I believe, and I'm not getting good messages when I type rails server . Instead I get Actually, I don't think that's quite accurate. I pretty sure WEBrick get installed with Ruby. In any case I don't use WEBRick. My particular preference is Phusion Passenger. I use the standalone for development. $ gem install passenger $ cd my_rails_app $ passenger start This works great for my needs. -- 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] why does self.included work but not include/extend
I have interesting situation. a.rb #file class A include M end b.rb #file module M include X extend Y end module X def instance_method end end module Y def class_method end end A.class_method = undefined method class_method Thats strange because what I expect to happen is module M extends Y so those class methods of Y are copied into A, and hence the A object can access those class methods. But thats not what happened. Ruby couldnt find the class methods. Yet when I change to this it worked: a.rb #file class A include M end module M def self.included(base) base.send :include, X base.send :extend, Y end module X def instance_method end end module Y def class_method end end end A.class_method = nil So this works, and the only difference is that X and Y modules are declared in M. Also I use the included hook which gets called when M is included in class A, and then passes A into argument list. Then we dynamically send methods (since include is a private method of A) of A, particuarly the inclue and extend methods passing our modules as arguments. And now it works. But why didnt the first example work? thanks for response -- 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: Bundler could not find compatible versions for gem railties:
I have the same problem. Here is an attempt to recreate the steps that caused it for me: Platform Windows 7 x64 - installed latest git (1.7.8.msysgit.0) - installed RailsInstaller (ruby 1.9.3) - installed DevKit - installed Heroku tools w/o Git I also have cygwin installed (not sure that is relevant but there have been issues with mingw32 apps). After installing all of the above I did the following: - Ran gems update - Followed Rails Tutorial exactly The tutorial process failed at the step for pushing to Heroku with error shown in the original question. I tried to work around the problem: * Tried changing Gemfile back to ~ versions * Deleted extra local versions of installed railsties and sass-rails, reinstalled only the specified versions * Tried using sass-rails 3.2.4 in Gemfile in hopes the dependency would correct itself Nothing worked. Sometimes a local bundle update/bundle install would work, sometimes it would fail. It seemed to always work from a git bash window and cmd.exe failed most of the time. But no matter what the outcome locally, when I tried to push to Heroku it always gave the error message above. Rubygems.org clearly shows that the sass-rails dependency on railties should be on 3.2.0.beta so something funky is going on. Just wish I knew what it is. -- 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.
Re: [Rails] Do I need WEBrick?
I agree with Adrian, it seems that the error is complaining about mySQL not being installed. Are you sure you have the mySQL server installed on your system? if yes Then make sure to add the 'mysql2' gem to your gemfile. Cheers!! 2012/2/29 Adrian Caceres cacere...@gmail.com Sure the problem is WEBrick? Error message seems to be complaining about mysql. Did you install mysql? On 02/29/2012 03:48 PM, Joel wrote: Hello, I started a class on RoR, and the instructor is using WEBrick, which he says ships with Rails. Is that still true? I've followed all the other instructions, I believe, and I'm not getting good messages when I type rails server . Instead I get joelrwesley$ rails server /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/mysql2-0.**3.11/lib/ mysql2.rb:9:in `require': dlopen(/Users/joelrwesley/.**rvm/gems/ ruby-1.9.3-p125/gems/mysql2-0.**3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/ mysql2-0.3.11/lib/mysql2/**mysql2.bundle Reason: image not found - /Users/joelrwesley/.rvm/gems/**ruby-1.9.3- p125/gems/mysql2-0.3.11/lib/**mysql2/mysql2.bundle from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/mysql2-0. **3.11/ lib/mysql2.rb:9:in `top (required)' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:68:in `require' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:66:in `each' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:66:in `block in require' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:55:in `each' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler/runtime.rb:55:in `require' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/bundler-* *1.0.22/ lib/bundler.rb:122:in `require' from /Users/joelrwesley/Desktop/**Sites/simple_cms/config/ application.rb:7:in `top (required)' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/railties- **3.2.1/ lib/rails/commands.rb:53:in `require' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/railties- **3.2.1/ lib/rails/commands.rb:53:in `block intop (required)' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/railties- **3.2.1/ lib/rails/commands.rb:50:in `tap' from /Users/joelrwesley/.rvm/gems/**ruby-1.9.3-p125/gems/railties- **3.2.1/ lib/rails/commands.rb:50:in `top (required)' from script/rails:6:in `require' from script/rails:6:in `main' joelrwesley$ Thanks, Joel -- 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.**comrubyonrails-talk@googlegroups.com . To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@**googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/** group/rubyonrails-talk?hl=enhttp://groups.google.com/group/rubyonrails-talk?hl=en . -- 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] Are there any clean alternatives to Unicorn for HTTP streaming?
Are there any clean alternatives to Unicorn for HTTP streaming? By clean I mean using the :stream option during render. class MyController ActionController::Base def index render :stream = true end end -- 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: Are there any clean alternatives to Unicorn for HTTP streaming?
Unicorn is clean. What I should have wrote is In addition to Unicorn, are there any other HTTP Servers, for Ruby on Rails, that cleanly support HTTP streaming? Thank you! On Feb 29, 10:41 pm, nosretep playersp...@gmail.com wrote: Are there any clean alternatives to Unicorn for HTTP streaming? By clean I mean using the :stream option during render. class MyController ActionController::Base def index render :stream = true end end -- 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: rails and javascript
There are a few ways to do this. If you are looking for an ajax response you can do the following: (this is an example with a new action) %= form_for Model.new, :remote = true do |f| % divYour Label/div div %= f.collection_select(:some_id, Model.all, :id, :name, :class = 'yourclass' % /div % end % Then in your javascript do something similar to: $('select#model_some_id').bind({ click:function () { // do something when it's clicked }, keydown:function () { // do something when a key is pressed down in the select }, keyup:function () { // do something when a key is pressed up in the select } }); This handles most of the browser events you'll find in Mozilla, IE, Safari, etc. as far as handling events. Some change events are not noticed by Mozilla (for instance if someone is using drop down arrows while in a select field). There are quite a few ajax tutorials out there. -- 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: Do I need WEBrick?
sudo apt-get install libmysql-ruby libmysqlclient-dev Enjoy. -- 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] Testing selector order in RSpec
Could someone point me to a reference that explains how I would test the order of elements on an HTML page? For example, in RSpec I would like to verify that the content of one p element appears before the content of another. response.should have_selector(p, :content = Should appear first) response.should have_selector(p, :content = Should appear second) The two lines above test that the 2 contents appear, but I don't know how to test that the first content appears before the second. Thanks Mike -- 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 pre-select a collection_select inside a form_for?
I'm curious what you have as far as relationships in your FriendType model? Does it belong_to :user? If so, %= f.collection_select(:user_id, FriendType.all, :id, :name, options= {:prompt = false}, {:class = 'yourCustomClass'}) % Hope that helps you out. -- 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 use link_to with :remote=true in rails 3.2.1
after doing some googling I got the answer wrong way : $(#allclick).update(%= escape_javascript(render(:partial = goclick)) %); correct way : $(#allclick).html(%= escape_javascript(render(:partial = goclick)) %); Instead of update now I'm using html -- 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.