[Rails] Re: how to use link_to with :remote=>true in rails 3.2.1

2012-02-29 Thread Manish Nautiyal
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")) %>"

[Rails] Re: how to pre-select a collection_select inside a form_for?

2012-02-29 Thread Alpha Blue
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-for

[Rails] Testing selector order in RSpec

2012-02-29 Thread Mike Kim
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 element appears before the content of another. response.should have_selector("p", :content => "Should appear first") re

[Rails] Re: Do I need WEBrick?

2012-02-29 Thread Alpha Blue
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 unsubscri

[Rails] Re: rails and javascript

2012-02-29 Thread Alpha Blue
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| %> Your Label <%= f.collection_select(:some_id, Model.all, :id, :name, :class => 'yourclass' %> <% end

[Rails] Re: Are there any "clean" alternatives to Unicorn for HTTP streaming?

2012-02-29 Thread nosretep
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 wrote: > Are there any "clean" alternatives to Unicorn for HTTP streaming? > > By "clean

[Rails] Are there any "clean" alternatives to Unicorn for HTTP streaming?

2012-02-29 Thread nosretep
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 "

Re: [Rails] Do I need WEBrick?

2012-02-29 Thread Benjamin Iandavid Rodriguez
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 > Sure the problem is WEBrick? Error m

Re: [Rails] Do I need WEBrick?

2012-02-29 Thread Adrian Caceres
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 othe

[Rails] Re: Bundler could not find compatible versions for gem "railties":

2012-02-29 Thread Bruce A.
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 (no

[Rails] why does self.included work but not include/extend

2012-02-29 Thread John Merlino
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 exte

[Rails] Re: Do I need WEBrick?

2012-02-29 Thread Robert Walker
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

[Rails] Re: ensuring random list of numbers are unique

2012-02-29 Thread John Merlino
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 Go

Re: [Rails] Do I need WEBrick?

2012-02-29 Thread Greg Akins
On Wed, Feb 29, 2012 at 6: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  

[Rails] Do I need WEBrick?

2012-02-29 Thread Joel
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/joelrw

[Rails] setting up a vps for rails: looking for advice, tutorials, etc.

2012-02-29 Thread scott
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

[Rails] Re: OpenSSL on rails 2

2012-02-29 Thread John Lane
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

[Rails] Re: OpenSSL on rails 2

2012-02-29 Thread Luis Lavena
On Feb 29, 5:30 pm, John Lane 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 for

[Rails] link_to alphabetical search

2012-02-29 Thread Christopher Jones
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_r

Re: [Rails] how to pre-select a collection_select inside a form_for?

2012-02-29 Thread Dave Aronson
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.Da

[Rails] OpenSSL on rails 2

2012-02-29 Thread John Lane
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 s

Re: [Rails] rails and javascript

2012-02-29 Thread Dave Aronson
On Tue, Feb 28, 2012 at 16:50, Dev Guy 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.w3scho

[Rails] Re: customise the color of link_to text

2012-02-29 Thread Linus Pettersson
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.c

[Rails] customise the color of link_to text

2012-02-29 Thread Christopher Jones
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:

Re: [Rails] Re: Deploying to a DMZ

2012-02-29 Thread Peter De Berdt
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 compile

[Rails] Re: Deploying to a DMZ

2012-02-29 Thread Bert Gloan
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. T

[Rails] Re: group validation

2012-02-29 Thread ruby LED
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

Re: [Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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

[Rails] Accessing raw cookie values?

2012-02-29 Thread sol
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

[Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
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 ima

Re: [Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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.pn

[Rails] requery using join

2012-02-29 Thread ads asd
I make 2 queries. - The first: @queue = Attempt.joins({:problem_info => [:problem, :contest]}, :user).where('contests.id' => 1).limit(100) - The s

Re: [Rails] group validation

2012-02-29 Thread Colin Law
On 29 February 2012 14:53, LED 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 ar

[Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
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

Re: [Rails] Re: If photo field blank then?

2012-02-29 Thread Colin Law
On 29 February 2012 15:04, 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, :heigh

Re: [Rails] Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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_phot

Re: [Rails] group validation

2012-02-29 Thread Peter Vandenabeele
On Wed, Feb 29, 2012 at 3:53 PM, LED 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

[Rails] Re: group validation

2012-02-29 Thread ruby LED
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? ** ed

[Rails] Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
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 displ

[Rails] group validation

2012-02-29 Thread LED
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 partic

Re: [Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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:Papercli

[Rails] Re: routes issues with rails3

2012-02-29 Thread Xuan
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 wrote: > Here i am using *rails3*, here the view.html.erb form have one login > button

[Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
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

Re: [Rails] Ruby IDEs

2012-02-29 Thread Max Schubert
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 wrote: > +1 for RubyMine. Everything is at your fingertips, and the debugging > is gr

Re: [Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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: > > undef

Re: [Rails] JIRA anyone?

2012-02-29 Thread Max Schubert
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

[Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
> #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 An

[Rails] routes issues with rails3

2012-02-29 Thread amvis
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 =

Re: [Rails] Re: Ruby IDEs

2012-02-29 Thread Paul
+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 wrote: > First: Free your mind from the shackle that comes from false belief > that IDE's are necessary for supe

[Rails] Re: JIRA anyone?

2012-02-29 Thread Robert Walker
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 ma

Re: [Rails] Re: If photo field blank then?

2012-02-29 Thread Walter Lee Davis
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. >>> <%= link_to "Show", user %> >>> >>> <% end %> >>> >>> For the following line I want to do something like this: >>>

Re: [Rails] Re: If photo field blank then?

2012-02-29 Thread Colin Law
On 29 February 2012 13:47, Christopher Jones wrote: > Walter Davis wrote in post #1049293: >> On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: >> >>> the users. >>>      <%= link_to "Show", user %> >>>     >>>  <% end %> >>> >>> For the following line I want to do something like this: >>> >>

[Rails] Passing params to :delete

2012-02-29 Thread Fraser C.
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

[Rails] Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
Walter Davis wrote in post #1049293: > On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: > >> the users. >> <%= link_to "Show", user %> >> >> <% end %> >> >> For the following line I want to do something like this: >> >> If user has photo > > <%- if user.photo.url? -%> > >>

[Rails] Re: how to use link_to with :remote=>true in rails 3.2.1

2012-02-29 Thread Manish Nautiyal
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 be

[Rails] Re: how to use link_to with :remote=>true in rails 3.2.1

2012-02-29 Thread Tim Shaffer
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 h

Re: [Rails] Deploying to a DMZ

2012-02-29 Thread Peter Vandenabeele
On Wed, Feb 29, 2012 at 12:06 PM, Colin Law wrote: > On 29 February 2012 10:42, Bert Gloan 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

Re: [Rails] Deploying to a DMZ

2012-02-29 Thread Colin Law
On 29 February 2012 10:42, Bert Gloan 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

[Rails] Deploying to a DMZ

2012-02-29 Thread Bert Gloan
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

Re: [Rails] getting error:undefined method 'current'

2012-02-29 Thread Colin Law
On 29 February 2012 09:26, sachin kewale wrote: > > > On Wed, Feb 29, 2012 at 1:57 PM, Colin Law wrote: >> >> On 29 February 2012 05:22, sachin kewale wrote: >> > >> > >> > On Tue, Feb 28, 2012 at 5:31 PM, Colin Law >> > wrote: >> >> >> >> On 28 February 2012 11:53, sachin kewale >> >> wrote:

Re: [Rails] getting error:undefined method 'current'

2012-02-29 Thread Michael Pavling
On 29 February 2012 09:26, sachin kewale 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 erro

Re: [Rails] getting error:undefined method 'current'

2012-02-29 Thread sachin kewale
On Wed, Feb 29, 2012 at 1:57 PM, Colin Law wrote: > On 29 February 2012 05:22, sachin kewale wrote: > > > > > > On Tue, Feb 28, 2012 at 5:31 PM, Colin Law > wrote: > >> > >> On 28 February 2012 11:53, sachin kewale > wrote: > >> > > >> > > >> > On Tue, Feb 28, 2012 at 5:06 PM, Michael Pavling

[Rails] how to use link_to with :remote=>true in rails 3.2.1

2012-02-29 Thread Manish Nautiyal
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

Re: [Rails] Re: ensuring random list of numbers are unique

2012-02-29 Thread Peter Vandenabeele
On Wed, Feb 29, 2012 at 3:05 AM, Robert Walker 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

Re: [Rails] ensuring random list of numbers are unique

2012-02-29 Thread Michael Pavling
On 29 February 2012 00:10, John Merlino 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 achie

Re: [Rails] getting error:undefined method 'current'

2012-02-29 Thread Colin Law
On 29 February 2012 05:22, sachin kewale wrote: > > > On Tue, Feb 28, 2012 at 5:31 PM, Colin Law wrote: >> >> On 28 February 2012 11:53, sachin kewale wrote: >> > >> > >> > On Tue, Feb 28, 2012 at 5:06 PM, Michael Pavling >> > wrote: >> >> >> >> On 28 February 2012 11:26, sachin kewale >> >> w