[Rails] Need help debugging syntax error from Agile Web Development, 3RD Edition

2009-12-03 Thread pauld
Hi-- I'm having trouble with a syntax error, which I'm working with on page 89 of Agile Web Development. I'm getting the following syntax error: /Users/pdenlinger/Sites/depot/app/models/product.rb:4: syntax error, unexpected tSYMBEG, expecting kDO or '{' or '(' validates_numericality_of :price

[Rails] Re: JRuby - How to make a server socket MT

2009-12-03 Thread Clemens
Ruby has a Thread class. t = Thread.new do ... end Depending on whether you want to act as a socket server you can make use of ruby's TCPServer, or if you want to connect to a (socket) server there's the TCPSocket class. What exactly do you want to do, what is your use case? Why do you need (lo

[Rails] Re: pdf generation

2009-12-03 Thread nas
There is a screencast here here http://railscasts.com/episodes/153-pdfs-with-prawn for this using prawn nas - http://nasir.wordpress.com http://twitter.com/_nasj http://github.com/nas - On Dec 4, 6:29 am, INDRANIL M

Re: [Rails] How to show two models output in one page

2009-12-03 Thread Dhruva Sagar
Hi, Obviously you can still have the post & the video content on the same page. But can you then explain the scenario that your trying to create ? For instance which video would you want to show in which post ? Logically it implies that they should be related and in the page where you display the

[Rails] pdf generation

2009-12-03 Thread INDRANIL MUKHERJEE
How to generate my view page as pdf document -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr.

Re: [Rails] How to show two models output in one page

2009-12-03 Thread suji A
No the models not related. Just i create 1 application and create post,video models inside it,the post model contains the title, content and the video model contains the title,description,video file. i want to show the title,content of the post model and the video in one page. Regards, Suji A. O

Re: [Rails] How to show two models output in one page

2009-12-03 Thread Dhruva Sagar
There are numerous ways you could achieve it. Can you give more details for your particular needs ? Are the two models related ? Thanks & Regards, Dhruva Sagar. On Fri, Dec 4, 2009 at 11:12 AM, suji A wrote: > Hi, > > I have two models post and video. How to combine their outputs and show it

[Rails] Rails and jQtouch

2009-12-03 Thread Calvin
Has anyone here tried using Rails and jQtouch together? I'm having some issues and looking to see if anyone has run into the same problems. Thanks, Calvin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send emai

[Rails] Re: Directory creation from Ruby

2009-12-03 Thread b...@vocaticommunications.com
Thank you to all who answered this question. I really appreciate and value your input. I did, in fact, end up doing this in the application controller which handles the submission and got it working. I was worried about the system call as well so thanks for stating the risks. If anyone needs he

[Rails] How to show two models output in one page

2009-12-03 Thread suji A
Hi, I have two models post and video. How to combine their outputs and show it in a one page. Regards Suji A. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. T

[Rails] db:test:purge And osql: What Happened?

2009-12-03 Thread MaggotChild
I thought I had read somewhere why db:test:purge continues to use `osql` but all I could find is this: http://dev.rubyonrails.org/ticket/7054 Obviously this never made its way into Rails. Why? What are people doing for MS SQL testing on non Windows OS'? Everyone's hacking their own workaround? See

[Rails] Re: Directory creation from Ruby

2009-12-03 Thread Sebastian von Conrad
I just want to echo Philip's comment for emphasis. Do NOT use system() for this, as it has serious security implications. Best, Sebastian On Dec 4, 10:24 am, Philip Hallstrom wrote: > > Hey everyone...trying to get a handle on Ruby syntax but having a bit > > of > > an issue. > > > I am trying t

Re: [Rails] Re: Rails 2.3.5 - Cannot install plugin

2009-12-03 Thread Hoang Nghiem
Thanks Matt !!! 2009/12/3 Matt Jones > > > On Dec 2, 10:47 pm, Hoang Nghiem wrote: > > Also, here is the RUBY_PLATFORM value : i386-mingw32. I used the > installer > > package fromhttp://rubyinstaller.org/download.htmlto install the ruby > > 1.9.1. I notice that the old ruby 1.8.7 I used refer

Re: [Rails] Directory creation from Ruby

2009-12-03 Thread Philip Hallstrom
> Hey everyone...trying to get a handle on Ruby syntax but having a bit > of > an issue. > > I am trying to create a form and then call a linux system call that > will > create a directory using the value of the variable within the > fieldset. > Here is a short example: > > > > > <%= f.label :na

Re: [Rails] Directory creation from Ruby

2009-12-03 Thread Dhruva Sagar
You need to put that system call in the controller action which receives this form submission! Where then you could do something like this : system('mkdir var/www/html/' + params[:model][:name]); Also it is not advisable to hard code the entire path. Thanks & Regards, Dhruva Sagar. On Fri, D

[Rails] Directory creation from Ruby

2009-12-03 Thread b...@vocaticommunications.com
Hey everyone...trying to get a handle on Ruby syntax but having a bit of an issue. I am trying to create a form and then call a linux system call that will create a directory using the value of the variable within the fieldset. Here is a short example: <%= f.label :name %> <%= f.text_field :

[Rails] Using default_url_options with named routes

2009-12-03 Thread HappyNoff
Hi there, I'm working on a little app with internationalization. When I try to create links like say : link_to "See post", @post The application crashes saying that there is a Routing error, that :locale contains my Post. My route for posts is like this : map.resources :posts, :path_prefi

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread Christoph Jasinski
After so many rich and deep replies I watched "grandmaster test" aka Bryan Liles video "TATFT: 'The Layman's Guide" ( http://aac2009.confreaks.com/07-feb-2009-13-30-tatft-the-laymans-guide-bryan-liles.html) again and it not only reminded me to test all the * time but also to go for RSpec, Cucumber

Re: [Rails] need help with CSS codes

2009-12-03 Thread Christoph Jasinski
checkout the themes plugin from Eric Berry at http://github.com/cavneb/themes There you see the example. It's just two lines of code you have to type. Good luck anyway. Cheers, Chris -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To po

[Rails] need help with CSS codes

2009-12-03 Thread Oluwayomi Oluwadara
hi,I need css codes that i can use.I need someone to help out because I don't want to use the one inside the text..agile web dev with rails that is available at  http://media.pragprog.com/titles/rails3/code/depot_c/public/stylesheets/depot.css Regards and Respects, Kindness in thought leads t

Re: [Rails] Re: Simple IF Statement help please

2009-12-03 Thread maryam kamali
ok iam wory ther is my world very polici On Thu, Dec 3, 2009 at 4:44 AM, -روشنک wrote: > good taime iam maryam my phone has danger there is iran i not wey > > On Dec 3, 2:11 pm, Colin Law wrote: > > 2009/12/3 Terry6004 : > > > > > > > > > > > > > Terry6004 wrote: > > > > >> Hi Mr Sagar, > > >

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread Hassan Schroeder
On Thu, Dec 3, 2009 at 9:36 AM, Colin Law wrote: > I disagree, not in the principle that a model should 'behave' as > specified, but whether this can always easily be ensured by top level > behavioural analysis. Sometimes special cases that should be tested > are much more obvious when looking a

[Rails] Re: stupid question about BDD

2009-12-03 Thread sax
Even if, from a high level, your feature uncovers the fact that there's a problem, a thorough set of specs testing specific low-level behaviors can tell you exactly where that problem lies. Five minutes of spec writing can save me an hour of troubleshooting. I'm still pretty new to TDD, but the tim

[Rails] Searching ActiveFoo

2009-12-03 Thread Jérémie Horhant
Hello, Activerecord is reading data from database and Activeresource is reading data from xml requests. But is there any class similar to the previous ones (with validation, errors support, form_for support, ...) for reading/writing data from arbitrary sources (maybe yaml or whatever) ? Thanks T

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread Colin Law
2009/12/3 s.ross : ... > I would suggest that it is not necessarily desirable to test every method in > a model. Rather, it is desirable to test whether your model does what it is > supposed to do -- irrespective of the methods used to achieve that end. This > makes the "refactor" of red/green/r

[Rails] Re: how to manage the caching of the results of long running queries

2009-12-03 Thread David
You could do that, but if the long running queries are executed in the controller before you get to rendering (where fragment caching is done), then it won't do much good against the problem you are trying to solve, because it will execute the queries for 30 seconds before getting to the rendering.

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread s.ross
On Dec 3, 2009, at 1:20 AM, Colin Law wrote: > 2009/12/3 Edward Middleton : >> Satyajit Malugu wrote: >>> Hassan Schroeder wrote: >>> >>> sax wrote: >>> > No, you should complement BDD with unit tests of some sort. >>> >>> Why? What does a "unit test" do that an RSpec test of your

Re: [Rails] Re: how to manage the caching of the results of long running queries

2009-12-03 Thread jay gallivan
This sounds like fragment caching rather than page caching. Is that right? On Wed, Dec 2, 2009 at 10:11 PM, David wrote: > Depends on how many queries they are and how long they take > individually. If it's one query that takes 30 seconds, then look at > breaking it up or optimizing it. If it's

Re: [Rails] Dynamic Paths

2009-12-03 Thread Rob Biedenharn
On Dec 3, 2009, at 11:32 AM, Nicholas Young wrote: > Hey there, > > I'm in the muck of a major rails project, and need a bit of advice. > Google isn't much help in this case, so I came here. > > I'm trying to set up a URL structure as follows: > > url.com/username/blog/post_id > > where the use

[Rails] Re: Dynamic Paths

2009-12-03 Thread David
Maybe something like this would work: in the user model: has_many :posts, :dependent => :destroy def to_param username end in the route: map.resources :posts, :path_prefix => ":username" Then in the view: post_url(post, :username => "donaldduck") In the controller: user = User.find_by_usernam

[Rails] Re: Problem with activesupport version

2009-12-03 Thread Matt Jones
Why is Rails 2.1.0 frozen in /home/srdan/rails/authlogic_example/ vendor/rails? That's what's causing the problem. The error is caused by authlogic specifying a dependency on activesupport, which wasn't properly stubbed in the gem index back in 2.1.0 (see https://rails.lighthouseapp.com/projects/89

[Rails] Dynamic Paths

2009-12-03 Thread Nicholas Young
Hey there, I'm in the muck of a major rails project, and need a bit of advice. Google isn't much help in this case, so I came here. I'm trying to set up a URL structure as follows: url.com/username/blog/post_id where the user has_many posts and the post belongs_to user. I'm using the friendly_i

Re: [Rails] Re: cap deploy problem...

2009-12-03 Thread Darian Shimy
You need to change the following lines: > role :app, "application" > role :web, "application" > role :db, "application", :primary => true Replace the application with the name of the host or IP Address. Darian Shimy -- http://www.darianshimy.com http://twitter.com/dshimy On Wed, Dec 2, 2009

[Rails] Re: Simple IF Statement help please

2009-12-03 Thread -روشنک
good taime iam maryam my phone has danger there is iran i not wey On Dec 3, 2:11 pm, Colin Law wrote: > 2009/12/3 Terry6004 : > > > > > > > Terry6004 wrote: > > >> Hi Mr Sagar, > > >> I ran that query in my console and it returned an array of times etc so i > >> will post one line to you which i

[Rails] ROR's / Mac Developer Position in Delaware

2009-12-03 Thread Ron
If anyone knows of a ROR's Developer with Mac experience please have them get in touch with me at ron.brin...@disys.com. I have an immediate opening for the right candidate. Thanks... Rron -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group

[Rails] Re: Rails 2.3.5 - Cannot install plugin

2009-12-03 Thread Matt Jones
On Dec 2, 10:47 pm, Hoang Nghiem wrote: > Also, here is the RUBY_PLATFORM value : i386-mingw32. I used the installer > package fromhttp://rubyinstaller.org/download.htmlto install the ruby > 1.9.1. I notice that the old ruby 1.8.7 I used refer to i386-mswin32 and the > 'mingw32' look like does n

[Rails] Ann: ArEvents

2009-12-03 Thread Raphael Bauduin
Hi, I needed to be able to add actions to be taken during the lifecycle of ActiveRecord object, but needed to configure it dynamically. Observers were not flexible enough and I ended up developing ArEvents, which lets you easily attach and detach event listeners, the events correspond to the activ

Re: [Rails] is there any tutorial for pay per click system?

2009-12-03 Thread Christoph Jasinski
What do you mean by that? Please describe more precise what you mean? Want to use Paypal (active merchant at http://www.activemerchant.org/) or something else? Chris -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,

[Rails] Re: is there any tutorial for pay per click system?

2009-12-03 Thread daociyiyou
is there any rails tutorial for pay per click system? It seems there is no one on google? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this gro

[Rails] Re: stupid question about BDD

2009-12-03 Thread byrnejb
On Dec 2, 12:52 pm, Christoph Jasinski wrote: > Hi, > > I'm divin' into BDD with RSpec, Cucumber & Friends and wanted to know > whether I got it right. When I go for BDD I skip unit tests? Is that right > or am I wrong? Neither. It depends on your workflow, the resources that you have and resu

[Rails] Re: returning image in my search results

2009-12-03 Thread Pat Shaughnessy
Hello... +1 for paperclip or attachment_fu; they will make this a lot easier for you. Earlier this year I wrote a detailed tutorial on how to setup and use Paperclip in a new Rails application. Coincidentally, my example was to attach photos to users and then to show different size photos. At the

[Rails] is there any tutorial for pay per click system?

2009-12-03 Thread daociyiyou
is there any rails tutorial for pay per click system? It seems there is no one on google? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this gro

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
There is no worry about creation as all i am trying to do is to read information created from the database. I inputted the data via sql statements which was quicker as i have so many records I will not be creating any new records all I need to do is display it, but displaying all those records is

Re: [Rails] Re: returning image in my search results

2009-12-03 Thread Leonardo Mateo
On Thu, Dec 3, 2009 at 5:56 AM, RubyonRails_newbie wrote: > hi, > > Thanks for the replies... > > I tried user.friends, and nothing happened. Well, i didn't get an > image anyway. > > How would i need to combine the user.friends line witht he actual path > to the image: <%= link_to thumbnail_tag(f

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Dhruva Sagar
In the create action of the controller where you create your bus_time record, I would suggest you to do this . Please change the following code as per your application code. params[:bus_time][:time] = Date.parse(params[:bus_time][:time]) The above code will ensure that the appropriate Date is cre

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread Rick DeNatale
On Thu, Dec 3, 2009 at 4:20 AM, Colin Law wrote: > That all depends on ones definition of a unit test of course.  I think > of a unit test as something that tests the model or other low level > component of an application (ie a unit).  I believe the term > originally arose from testing units of

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Colin Law
2009/12/3 Terry6004 : > > > > Terry6004 wrote: >> >> Hi Mr Sagar, >> >> I ran that query in my console and it returned an array of times etc so i >> will post one line to you which is: >> >> #> created_at: nil, updated_at: nil> >> >> Please note that the time attribute is time:time not datetime but

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
Terry6004 wrote: > > Hi Mr Sagar, > > I ran that query in my console and it returned an array of times etc so i > will post one line to you which is: > > # created_at: nil, updated_at: nil> > > Please note that the time attribute is time:time not datetime but rails > still gives me 2000-01-0

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
Hi Mr Sagar, I ran that query in my console and it returned an array of times etc so i will post one line to you which is: # Dhruva Sagar wrote: > > BTW %H:%M:%S should show 00:00:00 time as well if that is what it is since > %H is for 24 hour time and so on. > > Thanks & Regards, > Dhruva

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
Hi Mr Sagar, I ran that query in my console and it returned an array of times etc so i will post one line to you which is: # Dhruva Sagar wrote: > > Hi, > > Please tell me what values are you storing in the database for this 'time' > field ? > If your storing just %H:%M:%S values then I thi

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Dhruva Sagar
BTW %H:%M:%S should show 00:00:00 time as well if that is what it is since %H is for 24 hour time and so on. Thanks & Regards, Dhruva Sagar. On Thu, Dec 3, 2009 at 3:26 PM, Terry6004 wrote: > > Hi Mr Sagar, > > Yesterday i tried the code you helped me with which was: > > @bus_time = BusTime

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Dhruva Sagar
Hi, Please tell me what values are you storing in the database for this 'time' field ? If your storing just %H:%M:%S values then I think you should be using this as your find query : @bus_time = BusTime.find(*:all*, :order => "time", :conditions => ["time >= ? AND weekday = ?", *Time.now.strftime

[Rails] Re: AuthLogic Question - one time password (persistence_token) - what config is required to use this???

2009-12-03 Thread Greg Hauptmann
Actually I meant to say one-time password (not persistence) token. I'll have a look at the links. Can I ask something basic for authlogic...what is actually required in ones's normal controllers and model to ensure auhentication/login has taken place? Is "acts_as_authentic" just for the User mode

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
Hi Mr Sagar, Yesterday i tried the code you helped me with which was: @bus_time = BusTime.find(:first, :order => "time", :conditions => ["time >= ? AND weekday = ?", Time.now,Date::DAYNAMES[Date.today.wday]]) When this has to show 00:00:00 which is 12.00am it shows as nil and breaks my app. S

Re: [Rails] named_scope with at least one association

2009-12-03 Thread Pedro Del Gallego
> How would I write a named_scope that checks if the parent has at least > one associated child? First, its better to describe the problem a liitle bit, what I undestand if you want to find only the post that have post, Isnt it ? Look this example : I wrote by heart, so probably you will have som

Re: [Rails] Re: stupid question about BDD

2009-12-03 Thread Colin Law
2009/12/3 Edward Middleton : > Satyajit Malugu wrote: >> Hassan Schroeder wrote: >> >>     sax  wrote: >>     > No, you should complement BDD with unit tests of some sort. >> >>     Why? What does a "unit test" do that an RSpec test of your models >>     doesn't? >> >> About this topic from the aut

Re: [Rails] Simple IF Statement help please

2009-12-03 Thread Dhruva Sagar
Hi, The following code seems to be more accurate to achieve what you want to do. Station: <% if @train_time.station == "NMC" %> By New Mills Central <% else %> By New Mills Newtown <% end %> Thanks & Regards, Dhruva Sagar. On Thu, Dec 3, 2009 at 2:

[Rails] Re: stupid question about BDD

2009-12-03 Thread Bzouchir
I got it as wrong as you did. until I grabbed a copy of "The RSpec book" from the Pragmatic bookshelf http://pragprog.com/titles/achbd/the-rspec-book It's the best insight into the workflow and practices, I thought I got it all until i read this book (still reading...) It's worth it mate, Cheer

[Rails] Simple IF Statement help please

2009-12-03 Thread Terry6004
Hi all, I am a newbie trying to solve a simple IF statement problem in my show view. The code below is all about the station attribute where it has data which is either 'NMC' or 'NMN'. I want the view to show 'by new mill central if 'NMC' is true, but this does not work well as sometimes it show t

[Rails] Re: returning image in my search results

2009-12-03 Thread RubyonRails_newbie
hi, Thanks for the replies... I tried user.friends, and nothing happened. Well, i didn't get an image anyway. How would i need to combine the user.friends line witht he actual path to the image: <%= link_to thumbnail_tag(friend), profile_for(friend) %>? cheers On 2 Dec, 22:16, Leonardo Mateo