[Rails] Re: Noob Question D'Jour

2010-01-16 Thread Alex Walters
Cool. I think I get this (poked a page or two to understand what ":collection" was. I'll play around. thank you very kindly! Jaime Bellmyer wrote: > This is easy. Say you have a controller users_controller.rb, then in > config/routes.rb change: > > map.resources :users > -- Posted via http:/

[Rails] Re: Test params

2010-01-16 Thread Marnen Laibow-Koser
Learn by Doing wrote: > Hi, > > In my RESTful implementation, :new shows a form for @link . When a > user clicks on Create, the value of @link is posted to :create through > params. How do I test the value of params and that :create actually > uses these value to create a new link. > > Right

[Rails] Re: Test params

2010-01-16 Thread Jaime Bellmyer
What's your test suite of choice? Using plain old TestUnit, try something like this: def test_link_creates_correctly post :create, :link => {:name => 'Contact Us', :href => '/ contact', :title => 'Contact Us'} assert Link.find(:first, :conditions => {:name => 'Contact Us', :href => '/contact'

[Rails] Re: Noob Question D'Jour

2010-01-16 Thread Jaime Bellmyer
This is easy. Say you have a controller users_controller.rb, then in config/routes.rb change: map.resources :users to: map.resources :users, :collection => {:new_special => :get} If you have any other questions, hit me up via twitter (@kconrails) or my blog: http://kconrails.com/contact_me/

[Rails] Noob Question D'Jour

2010-01-16 Thread Alex Walters
Hello and thank you in advance. I am fairly new to Ruby and Rails and am working on an app in order to get more familiar. I feel I should be able to solve this problem on my own but have thus far been stymied. Thanks for your help. I used scaffold to generate the basic index/new/show/edit/destroy

[Rails] Re: Refresh automatically

2010-01-16 Thread Marnen Laibow-Koser
Robert Walker wrote: [...] >> Now that's just not true at all. If nothing else, lots of mobile >> browsers have deficient or nonexistent JS implementation -- even on >> smartphones like the BlackBerry Curve. (I speak from experience.) > > Such dumb devices would likely need their own dumbed do

[Rails] Re: Refresh automatically

2010-01-16 Thread Robert Walker
Marnen Laibow-Koser wrote: > Robert Walker wrote: >> Marnen Laibow-Koser wrote: >>> Whereas I'd use it in preference to the JS, because it's more reliably >>> guaranteed to work. >> >> I've given up the battle to make everything work without JavaScript. > > I have not and will not, except in iso

[Rails] Test params

2010-01-16 Thread Vincent P
Hi, In my RESTful implementation, :new shows a form for @link . When a user clicks on Create, the value of @link is posted to :create through params. How do I test the value of params and that :create actually uses these value to create a new link. Right now I test :create by by using a link

[Rails] Re: Refresh automatically

2010-01-16 Thread Marnen Laibow-Koser
Robert Walker wrote: > Marnen Laibow-Koser wrote: >> Whereas I'd use it in preference to the JS, because it's more reliably >> guaranteed to work. > > I've given up the battle to make everything work without JavaScript. I have not and will not, except in isolated circumstances. > JavaScript is

[Rails] Re: Beginner to Ruby

2010-01-16 Thread Demetrius
I started learning a little over a year ago. Although I have a long way to go, I can look back and see that creating an example app that was in the book (Agile Web Development with Rails, Third Edition), really helped me to learn what RoR can do. From there, I read through the details of the langua

Re: [Rails] Delayed Redirect

2010-01-16 Thread James Sullivan
There's actually an HTML meta tag that will handle redirects. http://www.web-source.net/html_redirect.htm Just change the content="x" to 5 so it'll indicate to the browser to wait 5 secs before redirecting to the given address. Regards, James On Sun, Jan 17, 2010 at 11:22 AM, tashfeen.ekram wro

[Rails] Re: Refresh automatically

2010-01-16 Thread Robert Walker
Marnen Laibow-Koser wrote: > Whereas I'd use it in preference to the JS, because it's more reliably > guaranteed to work. I've given up the battle to make everything work without JavaScript. JavaScript is most certainly winning this fight. Hardly anyone disables it anymore so I think it safe en

[Rails] check_box_tag doesn't insert parameter into table

2010-01-16 Thread Demetrius
Help! Can anyone see why my code isn't inserting the course_id parameter into my table? <%= f.label :course_id %> <% for course in current_user.courses.find(:all, :order => 'order_taught') %> <%= check_box_tag 'assessment[course_id][]', course.id %> <%=h course.name %>

[Rails] Re: Do you love to submit Bug reports? I have a patch to add better HTTP OPTIONS support.

2010-01-16 Thread Frederick Cheung
On Jan 15, 8:14 pm, CoolAJ86 wrote: > However, if you can point me to a full-blown, simple, "Hello World!", > "Patching Rails for Dummies" style guide which details how to write > the tests and the whole shebang, then I would be willing to do that. Have a look at http://guides.rubyonrails.org/

[Rails] Re: Formtastic and Access to Variables of Nested Model

2010-01-16 Thread GreenPlastik
Strangely, this code... <% f.semantic_fields_for :options do |c| %> <% @document.options.each do |option| %> <%= c.input :value, :label => option.name, :hint => option.hint %> <% end %> <% end %> ... end's up posting the names, the form fields and the hints twice. Also it seems

[Rails] Re: passing data to javascript function

2010-01-16 Thread le_fnord
give the value of such function wat you want, but as string, such as this in a view: :onclick => "toggle_memos('#{memos[:name]}')" or :onclick => "toggle_memos('something')" and in your *.js function toggle_memos(foo) { // doSomethingUsefullWithFoo console.log(foo); }; LeFnod On 1

[Rails] authorize state transitions

2010-01-16 Thread hj
Does anybody know how to authorize state transitions? I'm using state_machine in my rails app to define the state of an Article (published or unpublished). I'm also using declarative_authorization to determine the authorizations a user has. But how do I authorize a state transistion (determine if t

[Rails] Re: Dynamic Assets - can it be done?

2010-01-16 Thread le_fnord
another way is reusing code as in http://github.com/ryanb/nifty-generators given, by using the layout helpers down to each action by extending the default includes given in your layout(s) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To

[Rails] Beginner to Ruby

2010-01-16 Thread Akshay Nawale
Hello to all Ruby members, I am eager to learn Ruby for Rails.. I just bought the book "Ruby For Rails" by David A. Black Is it good enough for the beginner like me to start with this book Please Suggest... -- You received this message because you are subscribed to the Google Groups "Ruby on Rail

[Rails] Re: Accessing Raw Post Data

2010-01-16 Thread doug
> To get an array of ordered keys for the POSTed keys/vals, you could do > something like: > >   ... >   if request.post? >     ordered_keys = request.raw_post.split('&').collect {|k_v| > CGI::unescape(k_v.split('=').first.to_s) } >   ... Thanks. That worked great for parsing the raw post data (a

[Rails] Delayed Redirect

2010-01-16 Thread tashfeen.ekram
I want to create a page that when it opens it waits about five seconds and then redirects the user to another page. Is this normally done with JS? What is the easiest way to do this rails. Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Problem with 3-tier delete.

2010-01-16 Thread sultan
When I try to delete a grandfather in a grandfather, father & son relationship as in the following, the grandfather and all the associated fathers are deleted, but the sons are left as orphans. It seems ROR can do a 2-tier cascading delete, but fails on a 3-tier cascading delete. create_table "g

Re: [Rails] Re: Re: rendering partial chokes on :locals

2010-01-16 Thread Colin Law
2010/1/16 Laim Bee : > > I also tried creating a new Note object directly in the partial itself > and this didn't work. Is this the correct action that will occur when > you click the Post button: > > Looks in Routes > Runs method from Controller > Resolves View Yes, though I would say renders vie

[Rails] Re: polymorphic associations and STI

2010-01-16 Thread Matt Jones
On Jan 16, 11:21 am, "Michael M." wrote: > > For each inherited model of Message that you access by > > Post.inherited_modelname(s) (like in Post.first.letters) you need a > > has_many declaration in the Post class. > > Thanks. I thought has_many creates automatically the relation to the > subcl

[Rails] Re: Chaining queries in ActiveRecord

2010-01-16 Thread Matt Jones
On Jan 15, 4:25 pm, parkurm wrote: > Hi all, > > Stuck at this problem for several days. Tried to use named_scope, > scope_out, and plugin such as searchlogic, but no result. > > The problem is as follows: I have a pic table and tag table, and a > join table called pic_tag (with only pic_id and

[Rails] Extending instance-methods of an Module for Plugin-Development

2010-01-16 Thread klaus
Don't know if i should write this to rails or ruby mailinglist. But in the case i wan't to extend the facebooker-plugin without touching it, i will here. 1. Instance-Methods of modules? The methods in a module may be instance methods or module methods. Instance methods appear as methods in a class

[Rails] Re: Re: rake aborted!

2010-01-16 Thread Aashish Kiran
Bruno Grasselli wrote: > Try to execute "rake purchaseAlcohol" from here: > > D:/NetBeansProjects/RubyCode > > 2010/1/16 Aashish Kiran same error as before -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: T

[Rails] Re: Re: rendering partial chokes on :locals

2010-01-16 Thread Laim Bee
I also tried creating a new Note object directly in the partial itself and this didn't work. Is this the correct action that will occur when you click the Post button: Looks in Routes > Runs method from Controller > Resolves View I have tried putting logger.debug in the create method of the Note

Re: [Rails] Training

2010-01-16 Thread Curtis Cooley
On Fri, Jan 15, 2010 at 9:51 AM, gerbdla wrote: > Does anyone know of a place where I can get either online or classroom > training in the US preferrably on the west coast? > Have you looked at http://railsbridge.org/ or the associated site http://railstutor.org They are more focused on getting y

Re: [Rails] Re: Auto Sprite 1.0

2010-01-16 Thread Stephen
I do use this in a live project - its not just a "hey wouldn't this be cool moment" =) Would love to hear feedback/suggestions if anyone has some to share.. On Wed, Jan 13, 2010 at 5:33 PM, Marnen Laibow-Koser wrote: > Stephen wrote: > > Just curious - did anyone try this out with success/fail

Re: [Rails] Re: rake aborted!

2010-01-16 Thread Bruno Grasselli
Try to execute "rake purchaseAlcohol" from here: D:/NetBeansProjects/RubyCode 2010/1/16 Aashish Kiran > Bruno Grasselli wrote: > > Where are you keeping this file? > > > > If you put it in somewhere like: > > > > lib/tasks > > > > It should work. > > > > Try to add: > > > > desc "some text" > >

[Rails] Re: polymorphic associations and STI

2010-01-16 Thread Michael M.
> For each inherited model of Message that you access by > Post.inherited_modelname(s) (like in Post.first.letters) you need a > has_many declaration in the Post class. Thanks. I thought has_many creates automatically the relation to the subclasses. -- Posted via http://www.ruby-forum.com/. --

[Rails] Re: rake aborted!

2010-01-16 Thread Aashish Kiran
Bruno Grasselli wrote: > Where are you keeping this file? > > If you put it in somewhere like: > > lib/tasks > > It should work. > > Try to add: > > desc "some text" > > Before each task and then you can look for it when you type: > > rake -T > > 2010/1/16 Aashish Kiran when i execute D:\

[Rails] Converting snmpset() and snmpget() functions of php in rails

2010-01-16 Thread Atheeq Pasha
hello, I am trying to convert a php script into a rails script. I came accross snmpset() and snmpget() functions and I am stuck here. Here is a part of the php script. Please help me in converting these two functions. $oid = '1.3.6.1.4.1.318.1.1.12.3.3.1.1.4'; $toret = false; if($pdb->connec

Re: [Rails] rake aborted!

2010-01-16 Thread Bruno Grasselli
Where are you keeping this file? If you put it in somewhere like: lib/tasks It should work. Try to add: desc "some text" Before each task and then you can look for it when you type: rake -T 2010/1/16 Aashish Kiran > -rakefile- > > require 'csv' > require 'rake' > task

[Rails] Postgresql error

2010-01-16 Thread Atheeq Pasha
Hello, I successfully dumped the database in postgresql. Now I want to connect my rails application to the postgresql database, able to start the server, but I am getting this error when I browse the application from the browser. script/server => Booting WEBrick => Rails 2.3.5 application startin

[Rails] Re: Benchmarking a mailer

2010-01-16 Thread jhaagmans
Thanks for suggesting BIND, I usually only install BIND on a server running a nameserver, but this helps :) I've decided to go another way though. We can use the SMTP server on the receiving end directly from Rails, because it accepts direct SMTP requests from our server. Now I'd like to use two A

[Rails] Re: Training

2010-01-16 Thread Aashish Kiran
gerbdla wrote: > Does anyone know of a place where I can get either online or classroom > training in the US preferrably on the west coast? > > Thanks i am a part time trainer for ruby on rails. If you want to know more please contact me at aashishkir...@yahoo.com -- Posted via http://www.ruby

[Rails] rake aborted!

2010-01-16 Thread Aashish Kiran
-rakefile- require 'csv' require 'rake' task :purchaseAlcohol do puts "Purchased Vodka" end task :mixDrink do puts "Mixed Fuzzy Navel" end task :getSmashed do puts "Dood, everthing’s blurry, can I halff noth’r drinnnk?" end ---end when I run