[Rails] ActiveResource and InvalidAuthenticityToken exception

2008-09-28 Thread Jeff
Hi, I have a Rails 2.1.1 web app, and a Rails 2.1.1 app acting as a client by using ActiveResource. From the client, I can find, create, and update resources owned by the web app. However, I can not delete any. Calling the .destroy method in ActiveResource generates a 422 from the web app.

[Rails] Re: helper method problem

2008-09-28 Thread Jon Liu
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 submission, it's either 1 or 2 in this

[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 operations I would

[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 something

[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: 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

[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 strings

[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

[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

[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] 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

[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] 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: yes

[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

[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

[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.

[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.join(' ')}` sh:

[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

[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

[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

[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: 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 Windows -

[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 should link

[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] 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: 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] =

[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

[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 UTF-8,

[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',

[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

[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

[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

[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
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

[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: 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] 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

[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

[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

[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] 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)

[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