[Rails] Re: Limiting Access of Nested Resources

2008-09-28 Thread Xavier Noria
On Mon, Sep 29, 2008 at 6:45 AM, Tim K. <[EMAIL PROTECTED]> wrote: > So I'm using nested routes for a users model that has measurements and > journals... like this: > > map.resources :users do |users| > users.resources :journals > users.resources :measurements > end > > This of course builds ro

[Rails] Rails 2.0 book

2008-09-28 Thread Jae Lee
Can anyone recommend any book for Rails 2.0? I have read "Agile Web Development with Rails - 1st" and i loved this book. I wonder if there is any good guidance for Rails 2.0. Thank you! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received

[Rails] Re: Limiting Access of Nested Resources

2008-09-28 Thread Tim K.
Ramon - Fetching the current_user in the Journals controller doesn't solve the issue, unless I'm misunderstanding you. The current_user is set to in instance variable called @user so @user.id would be equal to :user_id within the route. When I call @journals I'm using the relationship to grab the

[Rails] Re: About: multi database performance on Substruct

2008-09-28 Thread Emanuele Tozzato
I'm using the normal Substruct authorization methods: each subdomain not only load the appropriate database (and every admin has his own password for his db), but alsocreate a different session and things stay clean and work (so far)! On Mon, Sep 22, 2008 at 11:38 PM, Ayyanar Aswathaman < [EMAIL P

[Rails] Re: Rails dates and times, 40.years.ago

2008-09-28 Thread Rails Terrorist
puts Time.year.now-40 puts Time.year.now-80 it is another solution if u dont want upgrade your rails. Y Reinhart AP Teapoci.Blogspot.com -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

[Rails] Re: Limiting Access of Nested Resources

2008-09-28 Thread Ramon Miguel M. Tayag
I've never done this but I'll give my 2 cents anyway: 1) With nested routes, you are always still looking for the user - you fetch it in the Journals controller and that's where you can evaluate it. What you can do is fetch the current_user unless the current_user is an admin or whatever 2) Abou

[Rails] Re: 65.years.ago on Windows XP

2008-09-28 Thread Rails Terrorist
<%= contact.calendar_date_select :birth_date, {:size => 10, :label => 'Birthday',:year_range => Time.now.year-65..Time.now.year} %> -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Rails] Limiting Access of Nested Resources

2008-09-28 Thread Tim K.
So I'm using nested routes for a users model that has measurements and journals... like this: map.resources :users do |users| users.resources :journals users.resources :measurements end This of course builds routes as something like: /user/:user_id/journals/:id /user/:user_id/measurements/:

[Rails] Re: Saas design considerations

2008-09-28 Thread Victor Al
I'm sorry if I misunderstood the purpose of your plugins then. I've come across your site several times before through Google searches (on RoR and SaaS) and from the descriptions, the focus seemed really on the billing aspect. That being said, I don't buy the "common sense" argument when desi

[Rails] FTP gem like AWS-S3?

2008-09-28 Thread Ramon Miguel M. Tayag
Hey everyone. Is there an FTP gem/plugin that allows you to browse and manipulate an FTP account just like AWS-S3 does with Amazon's S3 buckets? Thanks, Ramon Tayag --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "R

[Rails] Re: passing variable between methods

2008-09-28 Thread Katsuo Isono
Thank you very much. 100% what I needed. So, session[:member] = nil kills the session each time name action is processed. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[Rails] Re: how to send messages to mobile deveices from ruby on rai

2008-09-28 Thread Pokkai Dokkai
Phillip Koebbe wrote: > One way, though maybe not the best depending on your needs, is to send > an email to [EMAIL PROTECTED], such as [EMAIL PROTECTED] > > Peace. is it iphone ([EMAIL PROTECTED])? or is it for ordinary cell phone ? -- Posted via http://www.ruby-forum.com/. --~--~-~-

[Rails] Re: controller issue

2008-09-28 Thread Jon Liu
Phillip , my inventory_controller.rb: class InventoryController < ApplicationController def index @albums=Album.find(:all) @cart=find_cart end def add_to_cart itemType=params[:itemType] productId=(params[:id]) #parameter passed in from "add to cart" s

[Rails] Microsoft beats us to official JQuery support, Do we care?

2008-09-28 Thread ChessMess
Is it of any concern that more and more take up the JQuery banner? Why didn't they pick Prototype and Scriptaculous? Seems like we jumped on the REST bandwagon pretty quick but we hold to P&S in face of its ever growing popularity and adoption. Is Rails leadership tied to P&S on a more emotional l

[Rails] Re: summing child rows in HABTM table

2008-09-28 Thread Phlip
Dan Manges wrote: > def subscriber_salaries > subscribers.map(&:salary).sum > end That's inefficient. If you measure your application and find it will cause a bottleneck, you must put the sum, and the addition, on the database side. That crunches the numbers while they are much closer

[Rails] Re: Having trouble writing the right view to generate the de

2008-09-28 Thread Max Baroi
Now of course I'm having trouble with the default fields in edit. I've changed edit.html.erb so that editing an existing claim works. Here's my edit.html.erb Edit Claim's Information <%= "Enter claim number #{h(@claim.claim_number)}'s information." %> <% form_for :claim, :url => claim_path(p

[Rails] Re: summing child rows in HABTM table

2008-09-28 Thread Dan Manges
Hi Dave, You can use methods from the Enumerable module to get a list of salaries and calculate the sum. Try something like this: def subscriber_salaries subscribers.map(&:salary).sum end That will loop over each subscriber, build an array of the salaries, and then calculate the sum. I

[Rails] Re: controller issue

2008-09-28 Thread Jon Liu
All, I put the before_filter in my inventory_controller and it worked...didn't see that it doesn't belong in the Cart.rb file. Thanks for the help! Cheers Jon On Sun, Sep 28, 2008 at 4:03 PM, Jon Liu <[EMAIL PROTECTED]> wrote: > Heinbull, > > I tried to use the before_filter in my Cart Model.

[Rails] Re: controller issue

2008-09-28 Thread Jon Liu
Heinbull, I tried to use the before_filter in my Cart Model...mind you it's not an actual sql table, it's just a class I created. From looking at reference tools it looks like before_filter is usually used for actualy table models but I tried it any way and I got the error "undefined method b

[Rails] Re: summing child rows in HABTM table

2008-09-28 Thread Phlip
Phlip wrote: > dschruth wrote: > >> What if salary is not really a column in the database? >> >> What if it's a variable which is just a function of two other database >> columns? > >Subscriber.calculate( :sum, :salary, > :select => 'compensation + perks AS salary',

[Rails] Europe mirror for the official Rails repository

2008-09-28 Thread Mislav
Hey Rails devs, We're in Slovenia (southern Europe) and sometimes we get very slow speeds when pulling from the official Rails repository (GitHub). Speed can drop down to under 20 KiB/s, and the top I've seen is around 300. I've created a mirror on repo.or.cz from which we get a constant ~450 Ki

[Rails] Re: summing child rows in HABTM table

2008-09-28 Thread Phlip
dschruth wrote: > What if salary is not really a column in the database? > > What if it's a variable which is just a function of two other database > columns? Subscriber.calculate( :sum, :salary, :select => 'compensation + perks AS salary', :cond

[Rails] Re: h() doesn't have any parameter for encoding being used?

2008-09-28 Thread Xavier Noria
On Sun, Sep 28, 2008 at 5:01 AM, SpringFlowers AutumnMoon <[EMAIL PROTECTED]> wrote: > it seems that there is no parameter for the function h() (html_escape()) > to indicate the character encoding being used? > > for PHP, its htmlspecialchars() function has a dozen encoding possible, > such as UT

[Rails] Re: summing child rows in HABTM table

2008-09-28 Thread dschruth
Hey Dan, Got another question about this. What if salary is not really a column in the database? What if it's a variable which is just a function of two other database columns? For example what if 'salary' is a variable defined in the Magazine object but it's either 'gross_income' or 'gross_pa

[Rails] Re: controller issue

2008-09-28 Thread heimdull
>From experience I would use a before_filter to load the cart for you controller... Something like: before_filter :initialize_cart private def initialize_cart if session[:cart_id] @cart = Cart.find(session[:cart_id]) else @cart = Cart.create session[:cart_id] = @c

[Rails] Polymorphic model path problems

2008-09-28 Thread JHuizingh
I have a credentials_controller and Credential model. The Credential model is an STI structure with a number of classes inheriting it. For example: class CredWebsite1 < Credential When I try to do the index command in the credentials controller, it gives the error undefined method --

[Rails] Re: paperclip not working on update action (rails 2.1)

2008-09-28 Thread Keith
Remember to attach :html => { :multipart => true } to your form_for declaration for both the new.html.erb and edit.html/erb On Sep 7, 1:14 am, bingo bob <[EMAIL PROTECTED]> wrote: > Paperclipis nice but its not working on theupdateaction. > > Well, to be exact, I can attach new picture records vi

[Rails] Re: Observer not picking state change in user

2008-09-28 Thread Vahagn Hayrapetyan
Oh well. I just love those programming mistakes that make one appear like a total n00b because they are so basic one doesn't even stop to think about their possibility of occurring. Thanks Fred, it's working now :-) / Vahagn -- Posted via http://www.ruby-forum.com/. --~--~-~--~~-

[Rails] Re: Create a menu out from database entries

2008-09-28 Thread chovy
On Sep 28, 10:31 am, dlc <[EMAIL PROTECTED]> wrote: > Hi > > I am starting to work with rails and like to build a very basic cms. > > I was using scaffolding. > Page title:string permalink:string body:text. > > What I like to do is create a menu out of the database entries > permalink. > Those s

[Rails] Re: http request inside controller?

2008-09-28 Thread Kodak
On 26 Wrz, 01:00, Hubert Łępicki <[EMAIL PROTECTED]> wrote: > Hi, > > Can you access any other sites using http from within your > controllers? yes, I can so it is not rails problem, thank you - i will examine remote server why it is not responding to every request > I see you are using Window

[Rails] Re: [How to pass argument from a script to rails...]

2008-09-28 Thread Max Dev
Thank you for replies. > Have you looked at what #{ARGV} evaluates to? > would ARGV.join(" ") help? Yes, this works well with a call like: system (or sh) ("'rails' #{ARGV.join(' ')}") but not with: `"'rails' #{ARGV.join(' ')}"` sh: 'rails' prova -d mysql: not found I tried different forms

[Rails] Re: Regular expression to identity special character

2008-09-28 Thread Dejan Dimic
You can use http://www.rubular.com/ to test and find the regex you need. On Sep 28, 2:08 pm, MarcRic <[EMAIL PROTECTED]> wrote: > Hi Abhishek, > > Take a look on this article: > > http://marcricblog.blogspot.com/2008/08/bitwising-ruby.html > > More specifically, the last example. > > On that cas

[Rails] Create a menu out from database entries

2008-09-28 Thread dlc
Hi I am starting to work with rails and like to build a very basic cms. I was using scaffolding. Page title:string permalink:string body:text. What I like to do is create a menu out of the database entries permalink. Those should link to the fitting pages. So i modified my index.html.erb from

[Rails] Re: Having trouble writing the right view to generate the de

2008-09-28 Thread Max Baroi
Both suggestions did exactly what you said. 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 group, send email to ruby

[Rails] Re: [How to pass argument from a script to rails...]

2008-09-28 Thread Max Dev
Thank you very much Frederick, this has opened my eyes. Then, my mistake was to believe that I need "" for interpolation in ``. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

[Rails] Re: render partial vs. page.replace_html

2008-09-28 Thread Rails Terrorist
I just wanted to answer that, but you posted it faster than me hehehehe :D -- 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] Re: render partial vs. page.replace_html

2008-09-28 Thread Stephan Meier
Ok, i solved it :) i have to use: link_to_remote 'update', :update... and in the action simple: render :partial... greetings :) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

[Rails] Re: [How to pass argument from a script to rails...]

2008-09-28 Thread Frederick Cheung
On Sep 28, 4:20 pm, Max Dev <[EMAIL PROTECTED]> wrote: > Thank you for replies. > > > Have you looked at what #{ARGV} evaluates to? > > would ARGV.join(" ") help? > > Yes, this works well with a call like: > > system (or sh) ("'rails' #{ARGV.join(' ')}") > > but not with: > > `"'rails' #{ARGV.jo

[Rails] Re: Unable to update form...

2008-09-28 Thread Rails Terrorist
--- OR ANOTHER OPTION --- 1. 2.def update 3. @score = Score.find(params[:id]) 4. respond_to do |format| 5.if @score.update_attributes(params[:score]) 6. flash[:notice] = 'Score was successfully updated.' 7. format.html{redire

[Rails] Re: Unable to update form...

2008-09-28 Thread Rails Terrorist
You are in not rule of your routes.rb, because the error said that cant process ID=10 I suggest you do it : 1. 2.def update 3. @score = Score.find(params[:id]) 4. respond_to do |format| 5.if @score.update_attributes(params[:score]) 6. flash[:notice] = 'Score was su

[Rails] Re: Regular expression to identity special character

2008-09-28 Thread MarcRic
Hi Abhishek, Take a look on this article: http://marcricblog.blogspot.com/2008/08/bitwising-ruby.html More specifically, the last example. On that case I just consider words. You will need to adapt it to your needs. Regards. On Sep 27, 11:05 am, "Abhishek shukla" <[EMAIL PROTECTED]> wrote: >

[Rails] HOWTO matrix test with rspec

2008-09-28 Thread Tachikoma
Hey,guys I wanna matrix test with rspec but rspec_matrix isn't available So,helpme,3Q --~--~-~--~~~---~--~~ 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

[Rails] Re: Observer not picking state change in user

2008-09-28 Thread Frederick Cheung
On 28 Sep 2008, at 13:30, Vahagn Hayrapetyan wrote: > > > The problem is that the user.recently_reset? in the Observer returns > nil. > > When I test def recently_reset? interactively in the console (testing > the User model), it works as intended. So the user model works > correctly > and the

[Rails] Observer not picking state change in user

2008-09-28 Thread Vahagn Hayrapetyan
Hello,- does anyone have a good idea of how to trace a fault in the following: I have a User model (user.rb) with these methods: def create_reset_code code = User.get_random_string(10) #working class method self.password_reset_code = code self.save(false) @reset = true #Noti

[Rails] render partial vs. page.replace_html

2008-09-28 Thread Stephan Meier
Hey all, i simple try to update a partial in my index file. (it contains two partials, and i want to update one of them) But when i use, render :partial => it shows the partial but without the rest of the layout (navigation / footer...) if i use page[...].replace_html, it shows me the AJAX

[Rails] Re: passing variable between methods

2008-09-28 Thread Rails Terrorist
IF IT IS STILL IN 1 DIRECT PROCESS, YOU CAN DO IT : def member @member = params[:member] || '' member = @member name end def name name_id = @member end IF IT IS STILL IN DIFFENRENT PROCESS, YOU CAN DO IT : def member @member = params[:member] || '' member = @member

[Rails] passing variable between methods

2008-09-28 Thread Katsuo Isono
How can I pass @member varible from def member to def name and insert it into name_id? These methods are in the same controller. def member @member = params[:member] || '' member = @member end def name name_id = @member end -- Posted via http://www.ruby-forum.com/. --~--~-~

[Rails] Cannot expire cache from background process?

2008-09-28 Thread Justus Ohlhaver
Hello, I am trying to expire fragments (or at least trigger their expiration) from a daemon that's running in the background. The daemon is updating all kinds of important lists every few minutes from the background. So I have to find some way to DO or TRIGGER the fragment caching from this dae

[Rails] Re: sqlserver views instead of tables

2008-09-28 Thread DyingToLearn
I haven't played around with it myself, but this might be a place to start: http://activewarehouse.rubyforge.org/rails_sql_views/ mfairchi wrote: > Hello, > I have a legacy database in sqlserver 2005 that I am not allowed to > change. I have tried using a view, as I have read it works for > o

[Rails] Re: Having trouble writing the right view to generate the desire

2008-09-28 Thread Frederick Cheung
On Sep 28, 6:39 am, Max Baroi <[EMAIL PROTECTED]> wrote: > So patient_number is an attribute of the patient that owns the claim, > not an attribute of the claim itself. I think it's your use of the :index option that is giving you the current output instead of the second variant. For the third

[Rails] Re: [How to pass argument from a script to rails...]

2008-09-28 Thread metacoder
would ARGV.join(" ") help? Ruby is using to_s behind the scenes. Calling to_s on an array returns the values concatenated together in a string >> [1,2,3].to_s => "123" On Sep 27, 9:35 pm, Max Dev <[EMAIL PROTECTED]> wrote: > I have a script with which I want to create a rails app. > > Then not

[Rails] Re: h() doesn't have any parameter for encoding being used?

2008-09-28 Thread Conrad Taylor
On Sat, Sep 27, 2008 at 9:18 PM, Ryan Bigg <[EMAIL PROTECTED]> wrote: > > I don't think Rails supports UTF8 yet... but I could be wrong. The default charset for action renderings is UTF-8 since Rails 1.2. -Conrad --~--~-~--~~~---~--~~ You received this message b

[Rails] Re: h() doesn't have any parameter for encoding being used?

2008-09-28 Thread Frederick Cheung
On 28 Sep 2008, at 05:18, Ryan Bigg <[EMAIL PROTECTED]> wrote: > > I don't think Rails supports UTF8 yet... but I could be wrong. Actually it should handle utf-8 just fine. Rails 1.2 added a whole bunch of stuff to augment ruby's somewhat lackluster support. What does h do to utf-8 string

[Rails] Re: [How to pass argument from a script to rails...]

2008-09-28 Thread Frederick Cheung
On 28 Sep 2008, at 02:35, Max Dev <[EMAIL PROTECTED]> wrote: > > I have a script with which I want to create a rails app. > > Then not something like: > > $ rails -d mysql name_app > > in terminal, but from the script. > > In the script I get the app name, database etc. > After some operation