[Rails] Flaw in permalinking system.

2010-09-10 Thread youtube
Hi Basically I have a permalink system setup using the to_param method in the model file. Since I have a system in which categories has_many tutorials, my URLs look a bit like this: site.com/CatID-Category-Perma/TutID-Tutorial-Perma I have a system to redirect when the user puts in an ID to the

[Rails] [ANN] Mail 2.2.6 Released

2010-09-10 Thread Mikel Lindsaar
So after an intense day of bug squashing, I am pleased to announce Mail 2.2.6. Mail 2.2.6 is a bug fix release mainly, all users of the 2.2 series should definitely update. Changes include: * Fixed parsing an email with an empty In-Reply-To header (Reported by Eugene Pimenov) * Adding address

Re: [Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread William K. Hatch Jr.
Either that, or (not recommended really) you can enable the catch all route in routes.rb by uncommenting the line towards the bottom that looks like: match ':controller(/:action(/:id(.:format)))' but read the line above that, which tells you that if you do that, you'll enable access to all act

[Rails] Connection refused - connect(2)

2010-09-10 Thread Anthony Smith
I got this error this evening while running my specs: Connection refused - connect(2) I'm running under test/development and I'm using SQLite3. I didn't have this issue yesterday and my code hasn't changed since then. I looked around and people are saying that it's a DB connection problem (whi

[Rails] Having difficulty with threaded comments, using acts_as_tree

2010-09-10 Thread Kelp Kelp
I've been having problems making threaded comments for the last few days. Mainly with creating children and displaying the children. Currently, I have comments shown at the bottom of my articles show view. The top level comments work, but I do not really know how to implement a way for users to "re

[Rails] Manual Rake Tasks Question

2010-09-10 Thread Alpha Blue
Adapted from Ryan Bates: application_controller.rb def call_rake(task, os, options = {}) options[:rails_env] ||= Rails.env args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" } system "/usr/bin/rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Rails.root}/log/rake.log &" if os == 'linux'

[Rails] Re: Re: REST perhaps I don't undestand it.

2010-09-10 Thread James Byrne
Msan Msan wrote: > On 10 September 2010 15:40, Sandy wrote: >> >> �My routes.rb has �resources :rusers. >> �Try putting the following line into routes.rb: >> �map.connect 'user/logout', :controller => 'user', :action => 'logout' > > ButI have to set a route for every custom action that I add

[Rails] Re: Polymorphic advice for this design

2010-09-10 Thread Christian Fazzini
Basically when a user uploads content. Or when a user "likes" a product or comments on one. These three are interactions. If you are familiar with Facebook. The homepage displays a sort of user feed. This is what I am trying to achieve. To have something like this, I must have a single table. I was

[Rails] Set table value

2010-09-10 Thread Evanoshki Brataslavainskinski
Hi guys, I'm a newbie in ruby and I would just like to know how you set a value for a field in a table where session[:user_id] matches user.user_id. I am trying to do this from a submit form in the show.html.erb file because that is where the other field value is set. Help would be much apprecia

[Rails] Re: when is it okay to resort to find_by_sql?

2010-09-10 Thread Fearless Fool
Marnen Laibow-Koser wrote: >>> There are relatively few cases (not none, but few) where a subquery >>> should not be replaced by a join. Are you sure you need that subquery? Marnen: I owe your a debt of gratitude. Your note spurred me to *really* grok SQL joins. After thirty six hours of stu

[Rails] Re: Re: rails3 routes.rb DSL deprecation warning

2010-09-10 Thread James Byrne
radhames brito wrote: > gem cleanup i think you have an old version of a dependency I think that you were right. Thank you. -- 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 grou

[Rails] Paperclip - 'identify' command.

2010-09-10 Thread Abder-Rahman Ali
I'm following this tutorial: http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/ When it comes to running the application, I get the following errors: -Photo C:/Users/ABDER-~1/AppData/Local/Temp/stream,2396,0.jpg is not recognized by the 'identify' command. -Photo C:/Users/ABDER-~1

Re: [Rails] schedule to run a method?

2010-09-10 Thread Jeffrey L. Taylor
Quoting Ichiro Saga : > Hi, everyone. I wrote a ror app. One of the methods in controller > extracts data from files and saves it to database. Because there are > many new files every night, is it possible to run this method only every > night or every other night? Thanks in advance. > Simplest

[Rails] Re: rails 3 backends

2010-09-10 Thread Michael Schuerig
On Friday 10 September 2010, Kenneth Dunlap wrote: > Are there any decent backends for rails 3? Yes: passenger and mongrel are very decent backends. > passenger is > disqualified because of it's unfriendly install. I have a software > distribution system. I don't compile software on production

Re: [Rails] rails 3 backends

2010-09-10 Thread Greg Donald
On Fri, Sep 10, 2010 at 3:54 PM, Kenneth Dunlap wrote: > Are there any decent backends for rails 3?   passenger is disqualified > because of it's unfriendly install.  I have a software distribution > system.  I don't compile software on production machines. > mongrel2 is disqualified because it wo

[Rails] rails 3 backends

2010-09-10 Thread Kenneth Dunlap
Are there any decent backends for rails 3? passenger is disqualified because of it's unfriendly install. I have a software distribution system. I don't compile software on production machines. mongrel2 is disqualified because it won't compile on *BSD, since it insists on having sys/sendfile.

[Rails] protect_from_forgery

2010-09-10 Thread Dennis Monsewicz
I am a newbie to Rails, coming from a PHP shop, so please excuse my ignorance. I have to applications. A Codeigniter PHP app and a Rails 3.0 app. The rails app makes paypal api calls and the php app makes curl post calls to the rails app with information from a shopping cart. How can I make this

[Rails] PostgreSQL 8.3 not storing 'Date' field type with Rails 3.0

2010-09-10 Thread John Maxwell
Hi there, I've searched far and wide for an answer to this. I am using Rails 3.0.0 with Postgresql8.3 and ActiveRecord. Almost everything works fine - I have the normal timestamps, which store correctly, and a field called 'time' which is of the type 'time' and this works too. However, I also hav

[Rails] Re: Trying to do a report with a list of zip codes and getting stuck..

2010-09-10 Thread Bob Smith
On Sep 10, 11:52 am, Philip Hallstrom wrote: > > On 10 September 2010 05:41, Bob Smith wrote: > >> I'm trying to get a list of zip codes in my database with > > >> zipstring = sprintf("select distinct zip from visits,households where > >> " + > >>  "households.id=visits.household_id and visits.mo

[Rails] Re: Problem with unexpected nil in assert_select

2010-09-10 Thread James Byrne
I have determined that this is indeed a webrat problem. Evidently, webrat overrides assert_select in such a way as to break the Rails-3.0.0 implementation. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: T

Re: [Rails] Cumulative Sum with will_paginate and activerecord

2010-09-10 Thread Fidel Viegas
On 9/10/10, radhames brito wrote: > AR has a sum function. > Hi Radhames, I am aware of the sum function, but it does not do cumulative sum on its own. I know how to do it using recursive queries or stored procedures, but my question is how to deal with that using will_paginate. I will try to r

[Rails] Re: Problem with unexpected nil in assert_select

2010-09-10 Thread James Byrne
James Byrne wrote: >> >> The response.body inside the step definition contains exactly what I >> expect: >> >> >> To Proceed Please Authenticate Your Identity >> >> >> What do I need to change to get this test to work in Rails-3.0.0? > > Is there some place that lists the valid synt

Re: [Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread Mauro
On 10 September 2010 15:40, Sandy wrote: > >  My routes.rb has  resources :rusers. >  Try putting the following line into routes.rb: >  map.connect 'user/logout', :controller => 'user', :action => 'logout' ButI have to set a route for every custom action that I add to controller? -- You rec

[Rails] schedule to run a method?

2010-09-10 Thread Ichiro Saga
Hi, everyone. I wrote a ror app. One of the methods in controller extracts data from files and saves it to database. Because there are many new files every night, is it possible to run this method only every night or every other night? Thanks in advance. -- Posted via http://www.ruby-forum.com/

[Rails] Re: Re: REST perhaps I don't undestand it.

2010-09-10 Thread Marnen Laibow-Koser
Msan Msan wrote: > On 10 September 2010 15:40, Sandy wrote: >>> > �session[:user = nil >>> >>> >> There appear to be several typos: >> >> �session[:user = nil >> �should be: >> �session[:user = nil] (missing ]) > > Or should be session[:user] = nil > Is that the same? No, Sandy was in error. Be

[Rails] Re: Need help on Dicom Image viewer

2010-09-10 Thread Marnen Laibow-Koser
A Sarkar wrote: > DICOM is the image output of an X-ray machine. X ray plates are > things of past. Radiologists all over the world use DICOM images to > read an X-ray. They have special monitor through which they can view > the DICOM image. But the problem is that we cannot find a server > versio

Re: [Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread Mauro
On 10 September 2010 16:13, radhames brito wrote: > Couldn't find Ruser with ID=logout >> >> > My routes.rb has  resources :rusers. > > > > > the above means your user model has a diferent name than the one you are > usign I think it is correct. Model is Ruser, resources :rusers is set by scaffol

Re: [Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread Mauro
On 10 September 2010 15:40, Sandy wrote: > > > On Sep 10, 7:52 am, radhames brito wrote: >> you have a typo on your model name in controller. >> >> On Fri, Sep 10, 2010 at 4:59 AM, Mauro wrote: >> > I find hard to work with rest and custom actions. >> > I have an action >> >> > def logout >> >  

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread Matt Jones
On Sep 9, 2:24 pm, voidstar wrote: > Hi, > > I currently have a large array of model objects (around 5000 this > could grow to be in the 100k range) which have a date attribute.  I > want to filter this objects if one of their date attribute falls into > an array of years selected by the user.  

[Rails] Re: Need help on Dicom Image viewer

2010-09-10 Thread A Sarkar
DICOM is the image output of an X-ray machine. X ray plates are things of past. Radiologists all over the world use DICOM images to read an X-ray. They have special monitor through which they can view the DICOM image. But the problem is that we cannot find a server version of DICOM image viewer th

[Rails] Re: Unexpected behavior with respond_to

2010-09-10 Thread Erik Hetzner
At Mon, 6 Sep 2010 04:05:17 +0300, Svilen Vassilev wrote: > > I have similar issues with some js.rjs files after upgrading an app to rails > 3. Some respond_to blocks keep working fine as before and I get JS returned, > some keep trying to return HTML and thus spit out the 406 error. I haven't > fo

[Rails] Re: Problem with unexpected nil in assert_select

2010-09-10 Thread James Byrne
James Byrne wrote: > > Running the cucumber feature that invokes this step generates the > following error: > > undefined method `content_type' for nil:NilClass (NoMethodError) > /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-3.0.0/ > lib/active_support/whiny_nil.rb:48:in

Re: [Rails] Trying to do a report with a list of zip codes and getting stuck..

2010-09-10 Thread Philip Hallstrom
> On 10 September 2010 05:41, Bob Smith wrote: >> I'm trying to get a list of zip codes in my database with >> >> zipstring = sprintf("select distinct zip from visits,households where >> " + >> "households.id=visits.household_id and visits.month='%2d' and >> visits.year = '%4d' " + >> "and visi

[Rails] Re: How to implement a sandbox

2010-09-10 Thread Fritz Trapper
Marnen Laibow-Koser wrote: > I don't think you want to do that. I think you want to create a clone > of your *production* environment (call it sandbox or something) with a > separate database, then have a completely separate instance of the > application running with RAILS_ENV set to 'sandbox'.

[Rails] Re: (JOB) Ruby on Rails Programmer

2010-09-10 Thread Van
Rick, The guys at SliceHost.com might have some contacts. SliceHost was may still be in St. Louis, they got bought a few years ago. Van -- 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..

[Rails] Re: install rails 3 fedora 13 issues

2010-09-10 Thread rubyonrails3
You just need to restart terminal and than first make sure you can run rvm list or any rvm command. and than use this command rvm -- default ruby-1.8.7 -- 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

[Rails] Re: Anyone writing a Rails backend to elFinder?

2010-09-10 Thread Troex Nevelin
There is one person who is interested in writing RoR backend for elFinder http://elrte.org/redmine/boards/1/topics/1054 (page is in Russian, google translate can handle it). I'm one of the developers of elFinder, you can ask any questions and I will be glad to help implement elFinder on RoR. Btw

[Rails] Re: acts_as_list query

2010-09-10 Thread Ben Perry
> Does it matter?  AR operations tend to be transactional... It matters when dealing with concurrency. At the moment, everytime the queue gets updated as a result of someone moving items around in the queue or an item being removed from the queue, I use optimisitc locking to see if the queue has c

[Rails] Re: current_page? inside controller

2010-09-10 Thread Robert Pankowecki (rupert)
I have 3 different type of addresses fot person. I can create and display them using same views currently (but that might change in the future) so I created one controller which recognizes which kind of address you want to deal with now by checking the URL. In a moment when there is some benefit of

Re: [Rails] Will a Quad-core i5 processor significantly speed up development on Linux or Mac?

2010-09-10 Thread jason white
the presentation can be found at http://confreaks.net/events/lsrc2010, but it's not available just yet. On Fri, Sep 10, 2010 at 7:56 AM, Jeffrey L. Taylor wrote: > Quoting BlueHandTalking : > > I am looking at getting a new Thinkpad with an i5 processor. > > > > I was curious to what extent this

[Rails] Re: How to implement a sandbox

2010-09-10 Thread Marnen Laibow-Koser
Fritz Trapper wrote: > I would like to give my users an opportunity to switch the application > into a sandboxmode, where it is possible to play with it without the > danger to insert junk into the database. > > I guess, setting RAILS_ENV = 'development' works globally for the whole > server. Is t

[Rails] Re: Re: How to implement a sandbox

2010-09-10 Thread Fritz Trapper
radhames brito wrote: > read this , this guy had your prbblem > http://www.mail-archive.com/rubyonrails-talk@googlegroups.com/msg45941.html Very interesting. Thanks a lot. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Rub

Re: [Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread radhames brito
Couldn't find Ruser with ID=logout > > > My routes.rb has resources :rusers. the above means your user model has a diferent name than the one you are usign On Fri, Sep 10, 2010 at 9:40 AM, Sandy wrote: > > > On Sep 10, 7:52 am, radhames brito wrote: > > you have a typo on your model name i

Re: [Rails] Re: Polymorphic advice for this design

2010-09-10 Thread radhames brito
no, with what i showed you you can do <%...@user.comments.each |comment|%> <%=h comment.content%> <%comment.products.each do |product|%> <%=product.name%> <%end%> <%end%> also <%...@product.comments.each |comment|%> <%=h comment.content%> <%comment.users.each do

[Rails] Re: REST perhaps I don't undestand it.

2010-09-10 Thread Sandy
On Sep 10, 7:52 am, radhames brito wrote: > you have a typo on your model name in controller. > > On Fri, Sep 10, 2010 at 4:59 AM, Mauro wrote: > > I find hard to work with rest and custom actions. > > I have an action > > > def logout > >  session[:user = nil > > end > > > for controller user.

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread voidstar
Ah thank you Robert I'd missed that condition in my tests (lazy!) thanks On Sep 10, 2:03 pm, Robert Walker wrote: > Robert Walker wrote: > > Rails 2.x: > > :conditions => { timestamp_col_name => year_start...next_year_start } > > CORRECTION: > conditions => { :timestamp_col_name => year_start...n

[Rails] Re: RMagick to_blob display via AJAX call

2010-09-10 Thread John Chufar
Frederick Cheung wrote: > On Sep 9, 5:54�pm, John Chufar wrote: >> >> I still cannot see how to possibly pass a blob through ajax response, so >> this is the my simple (NOT effective approach) versus memory storage. >> > > I think the root of the problem you are grappling with is that putting > a

Re: [Rails] Re: How to implement a sandbox

2010-09-10 Thread radhames brito
read this , this guy had your prbblem http://www.mail-archive.com/rubyonrails-talk@googlegroups.com/msg45941.html On Fri, Sep 10, 2010 at 9:09 AM, radhames brito wrote: > > > On Fri, Sep 10, 2010 at 9:09 AM, radhames brito wrote: > >> what i am afraid that will be a problem are plug ins and gem

Re: [Rails] Re: How to implement a sandbox

2010-09-10 Thread radhames brito
On Fri, Sep 10, 2010 at 9:09 AM, radhames brito wrote: > what i am afraid that will be a problem are plug ins and gems, you could > add a filter in the action controller and stuff, but i think that the > plguins and gem may not follow > > > On Fri, Sep 10, 2010 at 8:16 AM, Fritz Trapper wrote: >

Re: [Rails] Re: How to implement a sandbox

2010-09-10 Thread radhames brito
what i am afraid that will be a problem are plug ins and gems, you could add a filter in the action controller and stuff, but i think that the plguins and gem may not follow On Fri, Sep 10, 2010 at 8:16 AM, Fritz Trapper wrote: > radhames brito wrote: > > anyway what you may be able to do is cha

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread Robert Walker
Robert Walker wrote: > Rails 2.x: > :conditions => { timestamp_col_name => year_start...next_year_start } CORRECTION: conditions => { :timestamp_col_name => year_start...next_year_start } ^ \__ Forgot to make this a symbol -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread Robert Walker
voidstar wrote: > Here's the finished method thanks again Colin > > def FilterUtils.get_readings_with_filters_applied reading_class, > meter_ids, timestamp_col_name, years, > > all_conditions = Array.new > > all_conditions += ["meter_id IN (?)", meter_ids] unless meter_ids > == nil || me

Re: [Rails] Will a Quad-core i5 processor significantly speed up development on Linux or Mac?

2010-09-10 Thread Jeffrey L. Taylor
Quoting BlueHandTalking : > I am looking at getting a new Thinkpad with an i5 processor. > > I was curious to what extent this would speed up developing a Ruby on > Rails > app. I am guessing that this depends to what extent multi-threading is > utilized, > but I am not sure---hence the question :

[Rails] Re: Polymorphic advice for this design

2010-09-10 Thread Christian Fazzini
Hi Radhames. Yea, the case you mention above would work. Except, since you are suggesting I have a comment table on its own. Then I would need to have a like and upload table on its own as well. If I needed to list recent interactions (to list down a user feed), I would have to union join the comm

[Rails] Re: How to implement a sandbox

2010-09-10 Thread Fritz Trapper
radhames brito wrote: > anyway what you may be able to do is change the db connection. How to do this? Does it work for a single session, while other sessions work in production mode? Is it possible to switch the current session to sandbox mode and back? -- Posted via http://www.ruby-forum.com

Re: [Rails] Simple_captcha issue

2010-09-10 Thread radhames brito
*recaptcha On Fri, Sep 10, 2010 at 8:02 AM, radhames brito wrote: > are you using racaptcha? > > > On Fri, Sep 10, 2010 at 6:43 AM, sam wrote: > >> I have a weird issue .I am using simple captcha in forms in my rails >> applications. If I am using one captcha in a web page I don't have any >>

Re: [Rails] Simple_captcha issue

2010-09-10 Thread radhames brito
are you using racaptcha? On Fri, Sep 10, 2010 at 6:43 AM, sam wrote: > I have a weird issue .I am using simple captcha in forms in my rails > applications. If I am using one captcha in a web page I don't have any > problem. But I have a scenario of using three(3) forms in one page in > which al

Re: [Rails] Re: current_page? inside controller

2010-09-10 Thread radhames brito
resources :addresses resources :mailing_addresses, :controller => 'addresses' <= this is here confuses me, why not have another controller? this will generate 7 restful action to a controller that has already 7 restfulaction but anyway it should be like this in you routes :requirement

Re: [Rails] REST perhaps I don't undestand it.

2010-09-10 Thread radhames brito
you have a typo on your model name in controller. On Fri, Sep 10, 2010 at 4:59 AM, Mauro wrote: > I find hard to work with rest and custom actions. > I have an action > > def logout > session[:user = nil > end > > for controller user. > In my view I call <%= link_to "Logout', :action => 'logo

Re: [Rails] Cumulative Sum with will_paginate and activerecord

2010-09-10 Thread radhames brito
AR has a sum function. On Fri, Sep 10, 2010 at 4:45 AM, Fidel Viegas wrote: > Hi everyone, > > I am trying to a cumulative sum on each page using will_paginate. I > don't want the sum of each page, but the cumulative sum. Here is an > example: > > on Page 1 I have: > > ---

Re: [Rails] How to implement a sandbox

2010-09-10 Thread radhames brito
anyway what you may be able to do is change the db connection. On Fri, Sep 10, 2010 at 7:49 AM, radhames brito wrote: > err , just add another connection to your database.yml file and create a > clone db , i dont remember who to switch environment without restarting the > webserver. > > > On Fri

Re: [Rails] How to implement a sandbox

2010-09-10 Thread radhames brito
err , just add another connection to your database.yml file and create a clone db , i dont remember who to switch environment without restarting the webserver. On Fri, Sep 10, 2010 at 4:44 AM, Fritz Trapper wrote: > I would like to give my users an opportunity to switch the application > into a

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread voidstar
Here's the finished method thanks again Colin def FilterUtils.get_readings_with_filters_applied reading_class, meter_ids, timestamp_col_name, years, all_conditions = Array.new all_conditions += ["meter_id IN (?)", meter_ids] unless meter_ids == nil || meter_ids.size <= 0 years.each{

[Rails] Re: (JOB) Ruby on Rails Programmer

2010-09-10 Thread gezope
Hi, Im not an expert, don't believe me! I would do this (after writing to mailing list, was good idea!): 1. There must be some meetup or conference around you about Ruby or Rails or Agile Development - go there. 2. Check if there is any Rails community around you - if not, than other programmer g

[Rails] Re: rails update fails

2010-09-10 Thread Dani Dani
Hi, why don't you go for Ruby 1.9.2/Rails 3.0... I had different problems installing rails on windows until I found the following link: http://accidentaltechnologist.com/ruby-on-rails/running-rails-3-on-windows/ Dani -- Posted via http://www.ruby-forum.com/. -- You received this message be

[Rails] Simple_captcha issue

2010-09-10 Thread sam
I have a weird issue .I am using simple captcha in forms in my rails applications. If I am using one captcha in a web page I don't have any problem. But I have a scenario of using three(3) forms in one page in which all the three forms will have the captcha . So that when I refresh the page the ca

[Rails] Re: Is it possible to do date arithmetic in an active record query without using custom sql ?

2010-09-10 Thread voidstar
Thanks Robert, yeah that's a silly thing to do :) Colin I'll try doing the :conditions => [ 'timestamp >= ? and timestamp <= ?', timestamp1, timestamp2 ] and see how it performs thanks I should have thought of doing that. radhames yeah it makes a lot more sense to do it in the db, just wrote some

[Rails] Re: current_page? inside controller

2010-09-10 Thread Anubhaw Prakash
Robert Pankowecki wrote: > Is there any easy way of using something like current_page? method > from ActionView::Helpers::UrlHelper inside controller ? > I have routing like: > resources :addresses > resources :mailing_addresses, :controller => 'addresses' > > And I would like to do a check in my

[Rails] current_page? inside controller

2010-09-10 Thread Robert Pankowecki (rupert)
Is there any easy way of using something like current_page? method from ActionView::Helpers::UrlHelper inside controller ? I have routing like: resources :addresses resources :mailing_addresses, :controller => 'addresses' And I would like to do a check in my controller that would look like this:

Re: [Rails] safe nil in rails views.

2010-09-10 Thread Colin Law
On 10 September 2010 09:25, Mauro wrote: > If you know grails, there is a feature like this: <% user.name? %> > that prevents to chek if the value is null or not. > In rails view I have to do > <% if user.name %> >  <%= user.name %> > <% end %> > to display user.name if it is not nil. > There is a

[Rails] REST perhaps I don't undestand it.

2010-09-10 Thread Mauro
I find hard to work with rest and custom actions. I have an action def logout session[:user = nil end for controller user. In my view I call <%= link_to "Logout', :action => 'logout'. When I click on link the error is: Couldn't find Ruser with ID=logout My routes.rb has resources :rusers. Ho

[Rails] Re: safe nil in rails views.

2010-09-10 Thread Fritz Trapper
Msan Msan wrote: > If you know grails, there is a feature like this: <% user.name? %> > that prevents to chek if the value is null or not. > In rails view I have to do > <% if user.name %> > <%= user.name %> > <% end %> > to display user.name if it is not nil. > There is a shortcut or some featur

Re: [Rails] safe nil in rails views.

2010-09-10 Thread Colin Law
On 10 September 2010 09:25, Mauro wrote: > If you know grails, there is a feature like this: <% user.name? %> > that prevents to chek if the value is null or not. > In rails view I have to do > <% if user.name %> >  <%= user.name %> > <% end %> > to display user.name if it is not nil. Not a gener

[Rails] Cumulative Sum with will_paginate and activerecord

2010-09-10 Thread Fidel Viegas
Hi everyone, I am trying to a cumulative sum on each page using will_paginate. I don't want the sum of each page, but the cumulative sum. Here is an example: on Page 1 I have: - |date | in | out |balance

[Rails] How to implement a sandbox

2010-09-10 Thread Fritz Trapper
I would like to give my users an opportunity to switch the application into a sandboxmode, where it is possible to play with it without the danger to insert junk into the database. I guess, setting RAILS_ENV = 'development' works globally for the whole server. Is there a possibility to switch a si

Re: [Rails] safe nil in rails views.

2010-09-10 Thread Peter De Berdt
And if user can potentially be nil, you can also use user.try(:presence) || "" This will avoid "undefined method 'presence' for nil:NilClass" errors. On 10 Sep 2010, at 10:27, Christiaan Van den Poel wrote: user.presence || "" see http://rubydoc.info/docs/rails/3.0.0/Object:presence On Fri,

Re: [Rails] safe nil in rails views.

2010-09-10 Thread Christiaan Van den Poel
user.presence || "" see http://rubydoc.info/docs/rails/3.0.0/Object:presence On Fri, Sep 10, 2010 at 10:25 AM, Mauro wrote: > If you know grails, there is a feature like this: <% user.name? %> > that prevents to chek if the value is null or not. > In rails view I have to do > <% if user.name %>

Re: [Rails] rails update fails

2010-09-10 Thread Christiaan Van den Poel
If is it only during the installation of the ri documentation, you shouldn't worry about it. if you do a 'gem list' you can see all the installed gems. On Thu, Sep 9, 2010 at 10:21 PM, Robin wrote: > I'm doing a manual (initial) installation of ruby 1.8.7, rubygems > 1.3.7 and rails. > I'm pret

[Rails] safe nil in rails views.

2010-09-10 Thread Mauro
If you know grails, there is a feature like this: <% user.name? %> that prevents to chek if the value is null or not. In rails view I have to do <% if user.name %> <%= user.name %> <% end %> to display user.name if it is not nil. There is a shortcut or some feature like that in grails? -- You r

[Rails] Re: NoMethodError in User sessionsController#create

2010-09-10 Thread lala chen
. On 9月10日, 上午5时28分, Ruby Rube wrote: > Having a frustrating go at authenticating a user, pretty sure it must > have something to do with gem version conflicts, but I can't seem to > find a solution that works. > > No matter what username & password that is entered into the login form I > get

[Rails] rails update fails

2010-09-10 Thread Robin
I'm doing a manual (initial) installation of ruby 1.8.7, rubygems 1.3.7 and rails. I'm pretty new at this. This is a windows installation. I started by installing ruby-1.8.7, then downloaded rubygems-1.3.7 and ran ruby setup.rb in the extracted gems directory I had created. These seemed to go well.

[Rails] Re: Freeze an attribute?

2010-09-10 Thread Frederick Cheung
On Sep 10, 1:30 am, "Jeffrey L. Taylor" wrote: > Quoting Frederick Cheung : > > > > > On Sep 9, 2:11 am, "Jeffrey L. Taylor" wrote: > > > Is it possible to to freeze a single attribute of an ActiveRecord (Rails > > > 2.3.5).  Hopefully in a way that isn't deprecated in 2.3.8 or 3.0. > > > attr_

Re: [Rails] Trying to do a report with a list of zip codes and getting stuck..

2010-09-10 Thread Colin Law
On 10 September 2010 05:41, Bob Smith wrote: > I'm trying to get a list of zip codes in my database with > > zipstring = sprintf("select distinct zip from visits,households where > " + >  "households.id=visits.household_id and visits.month='%2d' and > visits.year = '%4d' " + >  "and visits.monthly