[Rails] More than one submit_tag in a single form

2008-12-15 Thread Indu RS

Hai everyone ,
I have a list of users(each user in a row)and an Approve button for each
user. I wish to change the status of the user to be approved when I
click on the Approve button of a user. When I tried getting all the
users in the params hash. I want to get the id of the user according to
which "Approve" button I clicked. How can I implement this one?
Thanks in advance.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] how to enter and update difeerent tables data from views ?

2008-12-15 Thread srikanth

hi ,

i have two tables called streams and tags.
using tags table i am assigning tags to the stream table entries using
acts_as_taggable plugin.
Now problem is if i try to  enter the data for tag table in
new.html.erb file from views/streams getting error like

Couldn't find Stream without an ID problem

i have  tried to enter data in new.html.erb file like:
  
   Tags
   <%= f.text_area('tags_as_text') %>
   

instead if i use below code in views:


   Tags
   <%= text_field_tag 'tag_list', @stream.tags.collect { |tag|
tag.name.include?(" ") ? '"' +"#{tag.name}" + '"' :  tag.name }.join("
")%>
 

i am able to enter data but it is not reflecting in tag table and not
showing if i do the show option provided .

how to solve this problem?

thanks for any help or suggestions?

regards
Srikanth

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error in Mysql Connection

2008-12-15 Thread Freddy Andersen

I'm guessing in you database.yml file you have this:
development:
  adapter: mysql

So you need todo this:

# gem install mysql or if mysql is in a none standard area you need to
point to mysql_config like this:
# gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/
mysql_config (or where ever you have mysql installed)

Show us output from the following:

gem list
inside of you application => rake gems



--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: problem with scaffold

2008-12-15 Thread Johny Johndoe

Sumesh S wrote:
> Hello Ashit,
> 
> class AdminController < ApplicationController
>scaffold :product
> end
> 
> what u tried to create using the above code and also i think u can 
> access my
> giving
> 
> http://localhost:3000/product , rite?
> 
> regards,
> sumesh

I encounter the same problem while reading books agile web dev.I think u 
try
script/generate scaffold model attribute:datatype
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Upload File Using Form

2008-12-15 Thread Jason Hhh

I am trying to upload a CSV file through a form, process it, then input
the values in the file it into my database.  So first step, I need to
upload the file.  I created the form, uploaded a test file but I am
having trouble accessing the file in my controller.  I can access a hash
but all contains is the original filename of the file.  I guess my
question is how can I access this file and save it so that I can later
pass it to a CSV processing function.  I assume the file is uploaded to
some sort of temp file?  I am new at rails but I have accomplished
uploading and saving files in PHP before.  Any help would be great.

Thanks,

Jason
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: .erb invoked unexpectedly

2008-12-15 Thread RichardOnRails

BTW,  I included the routes.rb on that Pastie file.
--
R

On Dec 16, 12:01 am, RichardOnRails
 wrote:
> I've got an app that starts up with:
> map.root :controller => "csvs", :action => 'startup'
>
> The csvs_controller.rb is posted onhttp://www.pastie.org/340100
>
> The startup routine checks the RAILS_ROOT + "/public/data/csv"
> directory for any files.  Presently,  the directory has none.
> Consequently, "aHashes", an array of hashes in line #112 should be
> empty.
>
> That is indeed the case, as evidenced by the logger msg from line 113
> appearing in  the Command Window running Mongrel.
>
> Therefore I expect lines 114 & 115 to be honored, i.e. nothing to
> rendered and the index method to be invoked.
>
> Instead, I get:
> Missing template csvs/startup.erb in view path K:/_Projects/Ruby/
> _Rails_Apps/PayrollApp/app/views:
>
> Why is the app attempting to render something I don't expect ever to
> happen?  (If I do find files,  I'll insert their attributes in the
> database and redirect to index.
>
> Where am I going wrong?
>
> Thanks in advance,
> Richard
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error in Mysql Connection

2008-12-15 Thread RichardOnRails

I looked at you question again, which led me to add a couple of more
things:

Did you notice the advice:
"!!! The bundled mysql.rb driver has been removed from Rails 2.2.
Please
install the mysql gem and try again"

If you don't know how to use the "gem" system,  just Google for gem.
But if you use SQLite3,  you won't have to deal with installing MySQL.

Furthermore,  you must have found a way to opt for WEBrick.  The norm
for Rails 2 is Mongrel as the webserver.  Again, I recommend you go
with the default.

HTH,
Richard

On Dec 16, 12:13 am, Angappan Ayyavoo  wrote:
> Kyle wrote:
> > im new to ROR but i think i remember using this command when i had
> > that same error when i first started installing.
> > ruby\ gem install mysql
> > it was something along that line.
>
> > On Dec 15, 8:31 am, Angappan Ayyavoo 
> I tried with that, but getting the same error repeatedly.
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error in Mysql Connection

2008-12-15 Thread RichardOnRails

With Rails 2,  the default database server is SQLite3.  You apparently
added the optional MySQL.  I recommend you "go with the flow", i.e.
restart and allow the default DBMS to be used.

HTH,
Richard

On Dec 16, 12:13 am, Angappan Ayyavoo  wrote:
> Kyle wrote:
> > im new to ROR but i think i remember using this command when i had
> > that same error when i first started installing.
> > ruby\ gem install mysql
> > it was something along that line.
>
> > On Dec 15, 8:31 am, Angappan Ayyavoo 
> I tried with that, but getting the same error repeatedly.
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error in Mysql Connection

2008-12-15 Thread Angappan Ayyavoo

Kyle wrote:
> im new to ROR but i think i remember using this command when i had
> that same error when i first started installing.
> ruby\ gem install mysql
> it was something along that line.
> 
> On Dec 15, 8:31�am, Angappan Ayyavoo 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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] .erb invoked unexpectedly

2008-12-15 Thread RichardOnRails

I've got an app that starts up with:
map.root :controller => "csvs", :action => 'startup'

The csvs_controller.rb is posted on http://www.pastie.org/340100

The startup routine checks the RAILS_ROOT + "/public/data/csv"
directory for any files.  Presently,  the directory has none.
Consequently, "aHashes", an array of hashes in line #112 should be
empty.

That is indeed the case, as evidenced by the logger msg from line 113
appearing in  the Command Window running Mongrel.

Therefore I expect lines 114 & 115 to be honored, i.e. nothing to
rendered and the index method to be invoked.

Instead, I get:
Missing template csvs/startup.erb in view path K:/_Projects/Ruby/
_Rails_Apps/PayrollApp/app/views:

Why is the app attempting to render something I don't expect ever to
happen?  (If I do find files,  I'll insert their attributes in the
database and redirect to index.

Where am I going wrong?

Thanks in advance,
Richard
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Newbie installing EdgeRails: Error

2008-12-15 Thread John Yerhot

Can you freeze your current version?

rake rails:freeze:gems

I have the same Ruby version, Gem version, Rake, and Rails version and
I didn't have any issues freezing Edge Rails.  I'm on OSX Leopard.

On Dec 15, 3:51 pm, Michael Franzl  wrote:
> Hi,
>
> I'm using Ruby-1.8.7, Rubygems-1.3.1, Rails-2.2.2 and
> Rake-0.8.3.
>
> But getting EdgeRails via
>
>      rails test
>      cd test
>      rake rails:freeze:edge
>
> yields
>
>      rake aborted!
>      wrong number of arguments (2 for 1)
>
> What is wrong with this? The same error pops up with
> Rails-2.2.1 in combination with Rake-0.8.1.
>
> Hints appreciated!
>
> Michael
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Fukuoka Ruby Award--about $10,000 for first prize

2008-12-15 Thread Steven Budrys


On Dec 15, 2008, at 9:00 PM, Michael Kahle wrote:

>
> By no means have I learned enough Ruby ninjutsu to dream of entering a
> Ruby competition.  That said, what does this mean?
>
> From the link:
> =begin
> Eligibility
> ...
> Type B is for activities for prevalence.
> ...
> Specify URL to confirm for operation check in the first selection  
> except
> the case of activities for prevalence which haven’t actuating system.
> =end
>
> Huh?  What does this even mean?


 From the website I take it to mean there is a category for a business  
or enterprise which depends in a large part on Ruby, and also a  
category for activity which has increased the prevalence of Ruby.


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Fukuoka Ruby Award--about $10,000 for first prize

2008-12-15 Thread Ryan Bigg

It's Engrish, obviously. I'm sure their Japanese skills are better.
-
Ryan Bigg
Freelancer
http://frozenplague.net







On 16/12/2008, at 1:30 PM, Michael Kahle wrote:

>
> By no means have I learned enough Ruby ninjutsu to dream of entering a
> Ruby competition.  That said, what does this mean?
>
> From the link:
> =begin
> Eligibility
> ...
> Type B is for activities for prevalence.
> ...
> Specify URL to confirm for operation check in the first selection  
> except
> the case of activities for prevalence which haven’t actuating system.
> =end
>
> Huh?  What does this even mean?
> -- 
> 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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Git workflow

2008-12-15 Thread Miles Georgi

I would just create the bare repository, and then push to it.  It's
pretty straight forward, something like:

mkdir project.git
cd project.git/
git init --bare

Then go to where ever you have an up-to-date branch in a repository

git push somemachine:/path/to/git/repos/project.git master

you should definitely be using git with capistrano instead of copying
working directories, yikes

when people push seperately, they have some options.  The most
straight forward is to do a pull before doing a push.  That way it
merges any commits that you're missing.  Even better is to use rebase
so that it always looks like a fast-forward push (ie, your history
isn't full of merges that exist solely to get the lastest changes
since your last pull.)

you'll probably have to read up on some of these concepts.

On Mon, Dec 15, 2008 at 7:18 PM, giorgio  wrote:
>
> Thanks for that Miles.
>
> I had seen stuff about 'bare repositories' but didn't know what they
> were.
>
> Does an auto merge happen if two people push separately?
>
> Can I convert my server repo to a bare repository or should start
> again?
>
> Might have to change my Capistrano deploy as currently it does a file
> copy from the repo folder rather than via git
>
> G.
>
> >
>

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Trying to track down an issue in a performance based load test.. using Rails 2.2.2

2008-12-15 Thread s.ross

Here's a thought: If it's Ajax and your are POSTing from jQuery, check  
to see you have params. Some clients are sketchy about filling in a  
body of a POST by themselves.

On Dec 15, 2008, at 6:10 AM, Jay wrote:

>
> I am trying to debug an issue with Rails 2.2.2... I am running a load
> test where I am logging in and out 20 users, and I am occasionally
> seeing this error, in my logs:  (see stack trace below)  it appears
> that the body of some of my requests are null... I'm trying to figure
> out if a) it's a rails issue, b) is it a jruby/rack issue or c) is it
> an issue with caching (which is turned on but I wouldn't think should
> be an issue on a login/logout scenario).  any one have any thoughts on
> where I Could check to see why the body is null?  I'm off to try and
> turn off caching to see what happens but this issue is a pretty big
> issue and we need to resolve it asap.  We see it in normal usage of
> our website too.  It appears to be timing related but I'm not sure why
> or how yet.
>
> I'm not necessarily looking for THE answer but any general help of
> "check xxx" would be great.
>
> Thanks!
> Jay
>
>
>
>
>
>
> [#|2008-12-11T16:14:13.299-0500|INFO|sun-appserver9.1|
> javax.enterprise.system.container.web|
> _ThreadID=16;_ThreadName=httpWorkerThread-8081-1;|PWC1412: WebModule[]
> ServletContext.log():/!\ FAILSAFE /!\  Thu Dec 11 16:14:13 -0500 2008
>  Status: 500 Internal Server Error
>  undefined method `[]' for nil:NilClass
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:597:in `clean_up_ajax_request_body!'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:508:in
> `parse_formatted_request_parameters'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:441:in `request_parameters'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:392:in `parameters'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:30:in `request_method'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/
> activesupport-2.2.2/lib/active_support/memoizable.rb:86:in
> `request_method'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/request.rb:40:in `method'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/routing/route_set.rb:433:in
> `extract_request_environment'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/routing/route_set.rb:386:in `recognize'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/dispatcher.rb:182:in `handle_request'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/dispatcher.rb:120:in `dispatch'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
> applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
> lib/action_controller/dispatcher.rb:39:in `dispatch'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
> jsp/j2ee-modules/WebSite/loader/rack/adapter/rails.rb:37:in
> `serve_rails'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
> jsp/j2ee-modules/WebSite/loader/rack/adapter/rails.rb:44:in `call'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
> jsp/j2ee-modules/WebSite/loader/jruby/rack/rails.rb:145:in `call'
>/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
> jsp/j2ee-modules/WebSite/loader/rack/handler/servlet.rb:17:in `call':1
> |#]
>
> >


--~--~-~--~~~---~--~~
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: Git workflow

2008-12-15 Thread giorgio

Thanks for that Miles.

I had seen stuff about 'bare repositories' but didn't know what they
were.

Does an auto merge happen if two people push separately?

Can I convert my server repo to a bare repository or should start
again?

Might have to change my Capistrano deploy as currently it does a file
copy from the repo folder rather than via git

G.

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Calling an action within javascript function w/ ajax

2008-12-15 Thread hyuan

Just use remote_function and it will generate the appropriate ajax
call for you - this will make your code much less brittle to Rails
changes.

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html

HY


On Dec 13, 8:03 pm, David  wrote:
> Im thinking this needs to be a 'GET' request in order to return a
> response, but when I change the method to a GET, it calls the show
> action:
>
>   Parameters: {"username"=>"f", "action"=>"show", "id"=>"username",
> "controller"=>"users"}
>
> Stumped...
>
> On Dec 13, 8:01 pm, David  wrote:
>
> > I am trying to call an action within a javscript function using ajax,
> > but I am having some problems.  I need the ajax call to return a value
> > and am thinking I can do this using onComplete and Ajax.Request but I
> > am running into some problems.  This is the code I am using for the
> > Ajax.Request:
>
> >     new Ajax.Request( '/users/username', {
> >       method: 'post',
> >       parameters: { username: $('new_user_username').value},
> >       onComplete: parseResults()
> >     });
>
> > I have an action called username in my users controller in which I am
> > taking the username params passed by the Ajax.Request and seeing if it
> > exists in the database.  I want to return true/false depending on if
> > it exists or not.  But I am having trouble even getting the
> > Ajax.Request to work.
>
> > This is some of the output from the console:
>
> > Processing UsersController#username (for 192.168.1.105 at 2008-12-13
> > 19:52:39) [POST]
> >   Session ID:
> > BAh7BzoMY3NyZl9pZCIlYmNjM2YxODllZWIwMGM1NDkyMzQ0NjUyODMxODAz
> > ZTUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
> > c2h7AAY6CkB1c2VkewA=--d0d5fc597c61c2a295570ee9b118db7ba4285f3f
> >   Parameters: {"username"=>"d", "action"=>"username",
> > "controller"=>"users"}
>
> > ActionController::InvalidAuthenticityToken
> > (ActionController::InvalidAuthenticityToken):
>
> > Im not sure how to get around this InvalidAuthenticityToken, anyone
> > have any idea whats going on here.  Ive been struggling with this for
> > a while and am somewhat new to ajax so I could use some help.
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: I want to create text box but in run time

2008-12-15 Thread hyuan

text_field_tag

See:

http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html

On Dec 15, 12:52 pm, mahmoud_cs  wrote:
> On Dec 15, 2:31 am, Joshua Abbott 
> wrote:
>
>
>
> > There are two problems with that. One, all that's going to do is output
> > the text "text_field" not call the method. Second, text_field requires
> > two arguments object_name and method.
>
> > So anyway, use the send method to call the text_field method in the view
> > and pass in whatever args you need.
>
> > # Controller
> > @a = 'text_field'
>
> > # View
> > <%= send(@a, :object_name, :method) %>
>
> > Hope that helps.
>
> > -- Joshhttp://iammrjoshua.com
>
> unfortunately it didn't work
> it display that error                undefined method ` text_field '
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Fukuoka Ruby Award--about $10,000 for first prize

2008-12-15 Thread Michael Kahle

By no means have I learned enough Ruby ninjutsu to dream of entering a 
Ruby competition.  That said, what does this mean?

>From the link:
=begin
Eligibility
...
Type B is for activities for prevalence.
...
Specify URL to confirm for operation check in the first selection except 
the case of activities for prevalence which haven’t actuating system.
=end

Huh?  What does this even mean?
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] query

2008-12-15 Thread Newb Newb

Hi..
Actually i need to get

User's name
Contact's name and it's department id and it's  Authority id and
authority name.
so i done following query.
but its so long.
I don't know about join queries.
so pls help me how can i implemend join query instead of below query

user = UserInfo.find_by_id(user_id)

=>Using this query  I get user.first_name

contact = UserInfo.find_by_id(contact_id)

=>Using this query  I get contact.first_name and contact.department_id

authority = PrivilegeInfo.find(:first, :conditions => [ "user_id =? and
department_id =? ", contact_id,contact.department_id])

=>Using this query  I get authority.authority_id

authority_name = UserInfo.find_by_id(authority.authority_id)

=>Using this query  I get authority_name.first_name



Thanks in advance
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Saving a "final" version of a record.

2008-12-15 Thread Michael Kahle

Thank you Robert and Patrick for such thought provoking posts.  Notice 
how both of you are saying similar things to what Ar first suggested?

> Ar called it a "before_save callback function."
>> Robert suggested, "I suppose I could have done the update 
>> automatically on save depending on the state of the claim.
>> But, I chose instead to allow the user to update at their 
>> own discretion."
>>> Finally Patrick thought of the copy-on-write feature.

This got me thinking about rsync, or git; even Apple's Time Machine. 
All of these programs store data in a "state" that allows you to view 
the changes over a period of time.  What is this design pattern called? 
Has it been written about?

The software we use to run the business where I am employed has 
something like this on the accounting side.  The whole, "close out the 
month", feature.

Humm...
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: remote_function in IE with select input onchange

2008-12-15 Thread hyuan

Curious, how was the onchange event generated?  Did you use
remote_function?

It's been a while since I've used prototype for these calls - but I
know for a fact that this works using the jrails plugin and just
adding an onchange event to the pulldown via jquery and
remote_function.

HY

On Dec 15, 2:47 pm, Nik B  wrote:
> Here is the code:
>
> http://pastie.org/339967
>
> Generated HTML:http://pastie.org/339969
>
> This works great in Gecko and Webkit based browsers, but IE throws an
> error: "Object doesn't support this property or method". Any clues?
>
> Thanks,
> Nik
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: JOBS: Looking for RoR developers to work on enterprise website in Gibraltar

2008-12-15 Thread Stoyan Zhekov

On Dec 15, 3:47 am, Swordfish  wrote:

> We are using Ruby 1.8.6, Rails 2.0.2, Apache, Mongrel, HAProxy,
> Memcache and MySQL.  The web site talks to application tier (written
> in Java) using XML-RPC and JSON services.

Hm, if you already have apache, why to make so complicated stuff
(mongrel,haproxy)? Maybe better use passenger (2.0.6 just released).
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Params error with: complex form+multiple models

2008-12-15 Thread David Sousa

Hi Hassan Schroeder,
thanks for replay it.

So, to solve the problem I had to create a unique ID to each element.
That was easy I used this code:

<% fields_for "invoice[items_attributes][#{Time.now.tv_usec.to_s}]", 
invoice_item  do |form_invoice_item| -%>

And with Time.now.tv_usec.to_s I created a unique ID for each group of 
elements, and e got the params hash like this:

Parameters: {"commit"=>"Cadastrar", "invoice"=>{"mode"=>"in",
"items_attributes"=>{ "239625"=>[{"price"=>"2", "should_destroy"=>"", 
"quantity"=>"2", "id"=>"109", "item"=>"2"}],
  "48717"=>[{"price"=>"5", "quantity"=>"5", 
"item"=>"5"}],
  "238297"=>[{"price"=>"1", "should_destroy"=>"", 
"quantity"=>"1", "id"=>"108", "item"=>"1"}],
  "240939"=>[{"price"=>"4", "should_destroy"=>"", 
"quantity"=>"4", "id"=>"110", "item"=>"4"}],
  "236847"=>[{"price"=>"3", "should_destroy"=>"", 
"quantity"=>"3", "id"=>"107", "item"=>"3"}]},
"total"=>"123", "id"=>"45", "company_id"=>"10"}, 
"authenticity_token"=>"560d84898abf599368ad8ef6972ffbb649ecf0ee"}
( http://pastie.org/340083 ).

But I got a problem when accessing those attributes in  my model.
It was like this:
...
items_attributes.each do |attributes|
  invoice_item.build(attributes)
...
and I have to add a [1] to access the right attributes.
...
items_attributes.each do |attributes|
  invoice_item.build(attributes[1])
...

The attributes[0] give me = 239625, and
attributes[1] = price2should_destroyquantity2id109item2

To create I new record, every thing was ok.
To edit, I have to access the ID of the attributes variable... and I 
don't know how. I have tried attributes[1][:id], attributes[1][0], 
attributes[1][id].
Nothing seems to work. My model source code is here: 
http://pastie.org/340088

So to sum up, how can I access the Id attributes of attributes[1]

Thanks

David Sousa


-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Git workflow

2008-12-15 Thread Miles Georgi

generally, what people do is use a "bare" repository as the main
repository.  A bare repository has no working directory, and thus
doesn't have this issue.

On Mon, Dec 15, 2008 at 5:38 PM, giorgio  wrote:
>
> Hi,
> Can someone answer a couple of Git questions that are puzzling me?
>
> I have a repo on my Linux Server
> I 'git clone' the repo on my laptop (xp)
> I do some stuff
> I do a 'git add .' and a 'git commit -m "some comment"'
> I do a 'git push' to the remote origin (Linux server)
>
> Here is where it gets confusing...
> On the Linux repo the "index" is updated but not the "working tree"
> I have to do a 'git reset --hard' in order to see the laptop changes
> on the server.
>
> The question (finally) is:
> what do I do if several people are trying to push to the server?. I
> cant do a reset --hard as I will lose any changes somebody else has
> made.
>
> What happens on GitHub when several people push to a repo?
>
> I cant seem to find anything in the doco. Doing a pull or fetch/merge
> from the remote repo seems to be the recommended method but GitHub
> appears to use 'pushes'.
>
> Can anyone enlighten me or point me at some articles that may help.
>
> Thanks
> George
>
> >
>

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Git workflow

2008-12-15 Thread giorgio

Hi,
Can someone answer a couple of Git questions that are puzzling me?

I have a repo on my Linux Server
I 'git clone' the repo on my laptop (xp)
I do some stuff
I do a 'git add .' and a 'git commit -m "some comment"'
I do a 'git push' to the remote origin (Linux server)

Here is where it gets confusing...
On the Linux repo the "index" is updated but not the "working tree"
I have to do a 'git reset --hard' in order to see the laptop changes
on the server.

The question (finally) is:
what do I do if several people are trying to push to the server?. I
cant do a reset --hard as I will lose any changes somebody else has
made.

What happens on GitHub when several people push to a repo?

I cant seem to find anything in the doco. Doing a pull or fetch/merge
from the remote repo seems to be the recommended method but GitHub
appears to use 'pushes'.

Can anyone enlighten me or point me at some articles that may help.

Thanks
George

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Modify Session Data using session_id

2008-12-15 Thread Jeff Vogt

I just realized that since the objective is to modify another user's 
session data (as opposed to my own), the code I am using will work. 
There's one caveat, however, and someone correct me if I'm wrong:  If 
the user who's session data we are changing makes a request at the exact 
same time as our user who is modifying data, there's a chance that he 
will overwrite our changes, and there is no easy way to detect this.  Or 
is this not true in a single-threaded environment?

That being said, I'm also slightly embarrassed to post the following 
code, I have a feeling there's a much better way to do this.  But here 
goes:

@@connection ||= ActiveRecord::Base.connection
record = @@connection.select_one("SELECT * FROM sessions WHERE 
session_id = '#{other_sess_id}'")
a = record['data']
b = Marshal.load(ActiveSupport::Base64.decode64(a)) #demarshal and load 
session into b
b[:testdata] = 'data here'
c = ActiveSupport::Base64.encode64(Marshal.dump(b)) #marshal
@@connection.update("UPDATE sessions SET data = '#{c}' WHERE session_id 
= '#{other_sess_id}'") #save to db
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error in Mysql Connection

2008-12-15 Thread Kyle

im new to ROR but i think i remember using this command when i had
that same error when i first started installing.
ruby\ gem install mysql
it was something along that line.

On Dec 15, 8:31 am, Angappan Ayyavoo  wrote:
> Hai
>
>  Iam getting error in mysql connection.
>
> C:\Ruby\addr>ruby script/server
> => Booting WEBrick...
> => Rails 2.2.2 application started onhttp://0.0.0.0:3000
> => Ctrl-C to shutdown server; call with --help for options
> [2008-12-15 18:51:18] INFO  WEBrick 1.3.1
> [2008-12-15 18:51:18] INFO  ruby 1.8.6 (2008-08-11) [i386-mswin32]
> [2008-12-15 18:51:18] INFO  WEBrick::HTTPServer#start: pid=988 port=3000
> !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
> install the mysql gem and try again: gem install my
> 127.0.0.1 - - [15/Dec/2008:18:51:24 India Standard Time] "GET /contacts/
> HTTP/1.1" 500 13864
> - -> /contacts/
> 127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET /
> HTTP/1.1" 304 0
> - -> /
> 127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
> /javascripts/prototype.js HTTP/1.1" 304 0http://localhost:3000/-> 
> /javascripts/prototype.js
> 127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
> /javascripts/effects.js HTTP/1.1" 304 0http://localhost:3000/-> 
> /javascripts/effects.js
> 127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
> /images/rails.png HTTP/1.1" 304 0http://localhost:3000/-> /images/rails.png
> !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
> install the mysql gem and try again: gem install my
> 127.0.0.1 - - [15/Dec/2008:18:51:41 India Standard Time] "GET /contacts/
> HTTP/1.1" 500 13864
> - -> /contacts/
>
> and kindly give me some better links for the beginner to adapt with ruby
> on rails ( Latest)
> Iam using ruby 1.8.6 and rails 2.2.2
> or which version is better.
>
> Guide me.
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] faceted browse/filter

2008-12-15 Thread Grayson Piercee

Hello,

Are there any tools for facilitating faceted browsing / filtering for
A/R? I saw lots of examples for unstructured (solr, sphinx, etc), all
I'm looking for is something that helps me organize the cardinality of
lots of different attributes into a filter similar to that on Kayak and
other sites.

GP
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Modify Session Data using session_id

2008-12-15 Thread Jeff Vogt

Sadeesh Viswanthan wrote:
> Hi,
> Rather than accessing a base methods directly, you can access some
> class methods like 'process_cgi' to solve you pbm better I think. Try
> http://api.rubyonrails.org/classes/ActionController/Base.html#M000523
> this one and post here whether it helps you or not. I am also
> interested in knowing this.
> 
> Thanks,
> Sadeesh
> 
> On Dec 15, 4:41�pm, Jeff Vogt 

Thanks for the reply.

I played around with process_cgi and determined it wouldn't work for 
this application.  Further, I went into the code for action_controller 
to see how session data is saved.  I went as far as writing my own 
method that repeats the exact way session data is saved in Action 
Controller, but no dice.

What I think is happening, is when a request is made by the client, it 
grabs the current session data for a given session_id, THEN executes 
application code (including updating in memory any changes to the 
session data, THEN updates the database.

When we force changes to the session (by selecting sessions.data by 
session_id, modifying, and saving) INSIDE of a request routine, the data 
changes just fine, but is overwritten at the end of the request.

I think.

If anybody has an idea to access whatever is the temporary store for the 
session when it gets changed during a request, I'd love to figure this 
out.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Fukuoka Ruby Award--about $10,000 for first prize

2008-12-15 Thread Fukuoka

I am working with the Government of Fukuoka, Japan to get the word out
about the Fukuoka Ruby Award to Ruby developers in the US.  It is free
to apply for this award.  The top prize is about $10,000.  Deadline is
December 25, so there is not much time, but the application is fairly
simple for developers who have existing projects. Here are the
details:

Fukuoka Ruby Award
http://www.ruby-award.jp/english.html

Matz's posting about the award is here:  http://www.ruby-forum.com/topic/172192


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] remote_function in IE with select input onchange

2008-12-15 Thread Nik B

Here is the code:

http://pastie.org/339967

Generated HTML: http://pastie.org/339969

This works great in Gecko and Webkit based browsers, but IE throws an
error: "Object doesn't support this property or method". Any clues?

Thanks,
Nik
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: UPS shipping labels in EPL format?

2008-12-15 Thread Matt Howard

Jenifer Louie wrote:
> I'm using the UPS Shipping Tools to generate shipping labels... I'm able
> to successfully generate the label data (and I'm able to print the
> labels in GIF format), but I'm wondering how I could save EPL formatted
> label data, so a thermal printer (UPS Thermal 2844 from Zebra) can use
> it?  I tried saving the raw data in a text file and printing it, but
> that failed. I've also contacted UPS tech support, but they haven't been
> really helpful.  Does anyone have any insight on this or point me in the
> right direction?

Sorry to bump a fairly old thread.  I was searching for a slightly 
different question and saw this post, which I might be able to help 
with.

If you are planning to have the label printed at the client computer, 
and it is running Windows, UPS provides a plugin for FF and IE that will 
immediately print a label fed to it by the server, no questions asked. 
(Secure, I know.)  The way they've used it on the UPS site is within 
embed tags.  Since the plugin doesn't display anything, you'll want a 
HTML response with that embed tag in it, rather than sending the EPL 
data alone as a response.



The UPS EPL plugin can be found at http://tinyurl.com/6mpohy


If the client may be running Linux, you can make a script that can be 
associated with EPL files, which simply opens the serial device and 
sends the EPL data as is.  If you'll be printing labels at the server, 
and it's Linux, you'll do it about the same way, but printing through 
lpr with an unfiltered/raw device would be a bit smarter there.

If you want to print labels at the server and it's a Windows server, 
you'll need to open "LPT1:", "COM1:", or "USB001:" as appropriate and 
feed the EPL data there.

Hope this is helpful to you or anyone else searching on the subject!


--
Matt Howard 

-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Linking in SSL page to non SSL

2008-12-15 Thread Nik B

Fixed - thanks Fernando to get me on the right track. Once I looked up
protocol in routes I found this post and solved my problem:
http://siannopollo.blogspot.com/2007/08/rails-and-ssl-https.html

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: I want to create text box but in run time

2008-12-15 Thread mahmoud_cs



On Dec 15, 2:31 am, Joshua Abbott 
wrote:
> There are two problems with that. One, all that's going to do is output
> the text "text_field" not call the method. Second, text_field requires
> two arguments object_name and method.
>
> So anyway, use the send method to call the text_field method in the view
> and pass in whatever args you need.
>
> # Controller
> @a = 'text_field'
>
> # View
> <%= send(@a, :object_name, :method) %>
>
> Hope that helps.
>
> -- Joshhttp://iammrjoshua.com
>

unfortunately it didn't work
it display that errorundefined method ` text_field '


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Newbie installing EdgeRails: Error

2008-12-15 Thread Michael Franzl

Hi,

I'm using Ruby-1.8.7, Rubygems-1.3.1, Rails-2.2.2 and 
Rake-0.8.3.

But getting EdgeRails via

 rails test
 cd test
 rake rails:freeze:edge

yields

 rake aborted!
 wrong number of arguments (2 for 1)

What is wrong with this? The same error pops up with 
Rails-2.2.1 in combination with Rake-0.8.1.

Hints appreciated!

Michael

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Saving a "final" version of a record.

2008-12-15 Thread Patrick Doyle
On Mon, Dec 15, 2008 at 1:13 AM, Michael Kahle <
rails-mailing-l...@andreas-s.net> wrote:

>
> I'll start by apologizing for the title.  I can't think what to call
> this.
>
> I have some Claims that need to be entered, but when they are "closed"
> it saves the data from other related tables into the Claim (this could
> get messy), so that if the Customer, Registration, or Dealer information
> is changed at a later date it will remain the same as when the Claim was
> closed.
>
> Is there a preferred method for doing this?  Some kind of plugin or
> something?
>
> I understand I could have a separate table for keeping the "archived"
> version of the record, but I fear the work to create all new tables and
> then storing the record as this other new archive type which is nothing
> more than a duplicate of the Claim.
>
> Any thoughts?
>
> P.S. - Ask away, I am probably not explaining this perfectly, but I will
> try to elaborate if you are having trouble understanding my challenge.
>
I wonder if you could implement a "copy-on-write" feature in the Customer,
Registration, Dealer, etc... tables.  Basically, add a "freeze_record"
boolean column to those tables and set that to "true" when you need to
finalize one of those records.  If you ever want/need to update a frozen
record, you could allocate a new one, scan all of the claims to which this
record "belongs_to" and point all of those that are not closed to the new
record.

This strikes me as an ideal candidate for some sort of plugin that mixes
into ActiveRecord.  Unfortunately, I haven't the foggiest idea how to
implement the practical side of this theoretical solution (yet... but I'm
learning more every day).

--wpd

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: form for

2008-12-15 Thread Patrick Doyle
On Mon, Dec 15, 2008 at 1:20 PM, Maulin Pathare <
rails-mailing-l...@andreas-s.net> wrote:

>
> I have two models, ladder and statistic
> The relationship is
> ladder has_many statistics
> statistic belongs_to ladder
>
> In a view for my ladder controller action show, I am redirecting the
> user to an action in my statistics controller using
>
> <% form for ladder_statistics_path(@ladder) do |f| %>
>  <%= submit_tag 'Create' %>
> <%end%>
>
> I would think that in the statistics controller the object @ladder and
> all of its attributes would be available to me, but only the id is
> available in the params hash as params[:ladder_id]
>
> I have to explicitly call
>
> @ladder = ladder.find(params[:ladder_id])
>
> in the statistics controller to get @ladder.name
>
> is this normal, or am I doing something wrong?
>
That's the way I learned it, specifically from
http://akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial
.

--wpd

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] export file to csv Rails 0.14.1

2008-12-15 Thread curlysue282...@yahoo.com

Hello,

I am trying to figure out how to export to a csv.  I have found lots
on how to do this in later versions of Rails but I unfortunately I
must use this version of rails.  Anyone know of a good tutorial on how
to do this?

Thanks.
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] insecure: can't modify hash

2008-12-15 Thread Gregory Mirz

A weird problem occurs (only on the prod server, not locally), when i
try to register a new user with restful_authentication.

Once in a while, i get the following error when trying to sign up as a
new user:

Insecure: can't modify hash

usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:309:in
`delete'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:309:in
`write_attribute_without_dirty'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:139:in
`write_attribute'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:211:in
`deleted_at='
app/models/user.rb:113:in `make_activation_code'
app/controllers/users_controller.rb:30:in `create'
/usr/bin/mongrel_rails:16:in `load'
/usr/bin/mongrel_rails:16

Im really clueless on what's causing it. Even more strange is that it
doesn't right after a fresh deploy, and it doesn't happen locally. My
first reaction was to run rake db:sessions:clear in case there was some
unwanted persistence in the sessions, but it doesn't seem to come from
that...

If any knows about that error and could help... thanks :!
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: doubts in running a sample web application

2008-12-15 Thread Robert Walker

Angappan Ayyavoo wrote:
> Thanks.
> For ur kind reply.
> 
>  May I know which version of ruby and rails is stable.
> Give me some better links to learn and work in ruby on rails.

Ruby on Rails 2.2.2 is the current stable release of Rails.

http://rubyonrails.org/screencasts
http://guides.rubyonrails.org/
http://railscasts.com/
http://www.therailsway.com/
http://peepcode.com/
http://www.railsenvy.com/
http://api.rubyonrails.org/

Books:
http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition
http://www.amazon.com/Rails-Way-Addison-Wesley-Professional-Ruby/dp/0321445619

That should get you started. Also from those links, look for other 
related links and get to know the community of Rails developers. Find 
and read their blogs. There is a ton of really good information out 
there, once you know where to start looking.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Linking in SSL page to non SSL

2008-12-15 Thread Nik B

We're actually having to use URL for because of the subdomain plugin
creates malformed urls for nested resources :-(

On Dec 15, 12:53 pm, Fernando Perez 
wrote:
> > I'm using the ssl_requirement plugin. Is there a way to do this?
>
> > Thanks,
> > N
>
> Hi, we use the same plugin athttps://www.digiprof.fr/login, we
> experienced the same problems. The main gotcha, is that you are
> certainly using some_resource_path in your link_to instead of
> some_resource_url.
>
> Because with _path, the protocol used is the one of the current page
> because it actually generates relative paths. Using _url, the protocol
> of the page generated can be different as it generates absolute paths.
>
> Have you also edited routes.rb to add the correct protocol?
>
> --
> French training using VoD:http://www.digiprof.fr
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] conditional delete of a session

2008-12-15 Thread James Byrne

Rails 2.2.2
Ruby 1.8.6

ActiveRecord Session Store enabled

For testing purposes I wish to ensure that no session exists.  To
accomplish this I wrote:

  session.delete if session

But this fails if session == nil and I suspect that it does not work as
I anticipate if session exists.  In the console I see this behaviour:

$ script/console
Loading development environment (Rails 2.2.2)
>> app.session
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.session
from
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:429:in
`session'
from (irb):1

>> app.session.delete if app.session
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.session
from
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:429:in
`session'
from (irb):2

>> app.get "/"
=> 200

>> app.session
=> #> app.session.delete if app.session
=> []

>> app.session
=> #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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Saving a "final" version of a record.

2008-12-15 Thread Robert Walker

> I have some Claims that need to be entered, but when they are "closed"
> it saves the data from other related tables into the Claim (this could
> get messy), so that if the Customer, Registration, or Dealer information
> is changed at a later date it will remain the same as when the Claim was
> closed.
Michael,

I completely understand your dilemma. I spent quite a bit of time on a 
claims application myself. I can tell you that your statement, "This 
could get messy." is certainly true. Unfortunately, I don't know any way 
around it not being "messy." I don't know of any plugins or such that 
would help here, but maybe there are some.

The approach I took was to treat models related to the claim as 
"templates" for filling in the claim records. In my case this system was 
for the trucking industry. So I had to deal with information about truck 
drivers, claimants, insurance companies, etc.

My system would capture a "snapshot" of a driver (for example) and copy 
that data to a separate table that was then related to the claim. Then I 
provided a way for the user to update the driver's data in the claim to 
the latest version in the original driver record, but only if the claim 
was open. Once closed the update feature was no longer available.

I realize this is not ideal, but the alternative wasn't much better. I 
suppose I could have done the update automatically on save depending on 
the state of the claim. But, I chose instead to allow the user to update 
at their own discretion.

In my case some of the data needed to be captured (and frozen) based on 
the date of loss. We needed to know the driver attached to an order on 
the date of loss. So even if the order was assigned a new driver we 
still needed to capture the original driver's information that was 
involved in the claim. Which meant that is data had to be frozen when 
the claim was created, not when it was finally closed.

-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] form for

2008-12-15 Thread Maulin Pathare

I have two models, ladder and statistic
The relationship is
ladder has_many statistics
statistic belongs_to ladder

In a view for my ladder controller action show, I am redirecting the
user to an action in my statistics controller using

<% form for ladder_statistics_path(@ladder) do |f| %>
  <%= submit_tag 'Create' %>
<%end%>

I would think that in the statistics controller the object @ladder and
all of its attributes would be available to me, but only the id is
available in the params hash as params[:ladder_id]

I have to explicitly call

@ladder = ladder.find(params[:ladder_id])

in the statistics controller to get @ladder.name

is this normal, or am I doing something wrong?
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: calling a partial from within a model / model's method?

2008-12-15 Thread Nick Hoffman

On 2008-12-11, at 21:21, Joel Oliveira wrote:
> Weeks later I finally got around to figuring out how to best tackle  
> this and your suggestion was right on the money.  I didn't want to  
> let this lie without mentioning that the best bet started with that  
> nugget from the pastie link.  Thanks Nick :)
>
> - Joel

I'm glad to hear it helped! Good luck, mate.
-Nick

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Expire_fragment in observer/model? Works fine in Sweepers.

2008-12-15 Thread Marston A.

I've pretty much tried everything, but it seems impossible to use
expire_fragment from models?  I know you're not supposed to and it's
non-MVC, but surely there much be some way to do it.

I created a module in /lib/cache_helper.rb with all my expire helpers,
within each are just a bunch of expire_fragment calls.  I have all my
cache sweepers setup under /app/sweepers and have an "include
CacheHelper" in my application controller so expiring cache within the
app when called via controllers works fine.

Then things is I have some external daemons and especially some
recurring cron tasks which call a rake task that calls a certain
method.  This method does some processing and inputs entries into the
model, after which I need to expire cache.  What's the best way to do
this as I can't specify "cache_sweeper" within the model.

Straight up observers seem to be the best solution but then it
complains about expire_fragment being undefined etc etc, I've even
tried including the ActionController caching classes into the observer
but that didn't work.  I'd love some ideas of how to create a solution
for this.  Thanks.
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Saving a "final" version of a record.

2008-12-15 Thread Ar Chron

What about a before_save callback that checks if the values from other 
models should be stored locally (status changed and current status == 
'Closed')?
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Linking in SSL page to non SSL

2008-12-15 Thread Fernando Perez

> I'm using the ssl_requirement plugin. Is there a way to do this?
> 
> Thanks,
> N

Hi, we use the same plugin at https://www.digiprof.fr/login, we 
experienced the same problems. The main gotcha, is that you are 
certainly using some_resource_path in your link_to instead of 
some_resource_url.

Because with _path, the protocol used is the one of the current page 
because it actually generates relative paths. Using _url, the protocol 
of the page generated can be different as it generates absolute paths.

Have you also edited routes.rb to add the correct protocol?


--
French training using VoD: http://www.digiprof.fr
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Uploading Files

2008-12-15 Thread Hassan Schroeder

On Tue, Dec 19, 2006 at 3:00 PM, Mark Dodwell
 wrote:

> I don't get this error when uploaded in development mode on my home
> machine, only in production mode on my live server.
>
> Any clues as to what this error means or how to resolve it?
>
> PS. I'm running Pound in front of a Mongrel cluster and Lighttpd server.

Are you running the same configuration in your dev environment?
If not, can you try it, or alternatively try uploading directly to one of
the mongrels (bypassing Pound/Lighttpd) in production?

Seems like the first thing to try to eliminate from the equation :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: HTML in db columns

2008-12-15 Thread Robert Walker

>> The column is a text type. I get   but not  The bullets
>> are just left out.
It sounds to me like your HTML is getting sanitized somewhere, which is 
actually a really good thing. Allowing raw HTML to be passed though from 
an input (textfield, textarea, etc.) and then displayed without being 
sanitized can lead to all sort of security problems.

My recommendation would be to look into supporting Textile/Markdown in 
your input textarea and make sure you are properly sanitizing your HTML. 
Otherwise, you may leave yourself open to cross-site scripting or SQL 
injection attacks.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Third Party Tool for Business Directories?

2008-12-15 Thread JimCifarelli

Hello again Rails Community,

I'd like to add a subscription based "Business Services Directory" to
a Rails app so that other businesses can advertise under a "category".

This site currently uses third party tools in many views to offer
event calenders and for taking polls.

Is there a third-party service (like for calendars or poll questions)
for this paid directory listings/search/sign-up service?

I know I've seen outsourced "Knowledge Base" functionality so that one
could include a knowledge base within their site.  What I need is
similar in practice but different in content.

Thank you for your time.


Sincerely,
Jim


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Scaffold leads to OK database, but model empty

2008-12-15 Thread Robert Walker

>>> @csv = Csv.new
> => # imported: nil, created_at: nil, updated_at: nil>
One other thing that might be noteworthy...

Notice how your "created" and "modified" attributes are redundant with 
"created_at" and "modified_at." You might want to consider using the 
ones provided by Rails by default. This way you have no additional work 
in updating these standard fields. Rails with take care of them for you.

Then you also have the "imported" attribute. Since this is also a date 
field you might want to follow the Rails convention for naming date and 
time fields by appending "_at" or "_on" so you could have "imported_on" 
if you want a date only or "imported_at" if you want to also record the 
time along with the date.

Also note that the default attributes added by "t.timestamps" in your 
migration will use date and time, but you can always format your view to 
show date only if you want. And, of course, you will need to update the 
value of "imported_at" yourself since it not something Rails can do 
automatically.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Scaffold leads to OK database, but model empty

2008-12-15 Thread RichardOnRails

Hi Hassan,

> ... opening your Rails console and ...

Excellent addition.  It’s so much better to have proof than relying on
faith.!  Just to prove your effort wasn’t wasted on me:

K:\_Projects\Ruby\_Rails_Apps\PayrollSysAnew>ruby script/console
Loading development environment (Rails 2.2.0)
>> @csv = Csv.new
=> #

Many thanks,
Richard


On Dec 15, 11:21 am, "Hassan Schroeder" 
wrote:
> On Mon, Dec 15, 2008 at 8:12 AM, Jeremy McAnally
>
>  wrote:
>
> > ActiveRecord automatically discovers the fields in your model's table
> > and creates accessor methods for you at runtime, so the model shown is
> > all you need.
>
> Exactly, and
>
> >> ruby script/generate scaffold Csv filename:string created:date
> >> modified:date imported:date
>
> ..probably worth mentioning that you can easily confirm something
> like this by opening your Rails console and entering e.g.
>   �...@csv =  Csv.new
> and viewing the output.
>
> FWIW,
> --
> Hassan Schroeder  hassan.schroe...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActiveRecord Oracle and nvarchar2 or nclob datatype

2008-12-15 Thread mrbana...@googlemail.com

Just in case somebody is facing this issue as well...

It seems that ActiveRecord is not handling oracle nvarchar2 column
types correctly.


If somebody is facing my issue: Please find beloa the code for a fix
Many thanks to the oci adapter engineer who did the main work for it.

module ActiveRecord
  module ConnectionAdapters #:nodoc:
class OracleColumn < Column #:nodoc:
  attr_reader :nchar
  def initialize(name, default, sql_type, null)
super
@nchar = (@type == :string && sql_type[0,1] == 'N')
  end
end

class OracleAdapter < AbstractAdapter
  def quote(value, column = nil) #:nodoc:
if value && column && [:text, :binary].include?(column.type)
  %Q{empty_#{ column.sql_type.downcase rescue 'blob' }()}
elsif value && column && column.nchar
  'N' + super
else
  super
end
  end
end
  end
end
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Scaffold leads to OK database, but model empty

2008-12-15 Thread RichardOnRails

Hi Jeremy,

> ... so the model shown is all you need.

Thanks.  I was hoping I'd discover something of "The Rails Way".

Best wishes
Richard


On Dec 15, 11:12 am, "Jeremy McAnally" 
wrote:
> ActiveRecord automatically discovers the fields in your model's table
> and creates accessor methods for you at runtime, so the model shown is
> all you need.
>
> --Jeremy
>
> On Mon, Dec 15, 2008 at 10:03 AM, RichardOnRails
>
>
>
>  wrote:
>
> > Hi,
>
> > I ran:
> > ruby script/generate scaffold Csv filename:string created:date
> > modified:date imported:date
> > rake db:migrate
> > sqlite3 db\development.sqlite3
> >    .dump csvs (database columns displayed as expected)
> > type app\models\csv.rb (which displayed only:
> >    class Csv < ActiveRecord::Base
> >    end
> > with no field names)
>
> > I'm inclined to just populate the latter with:
> >   �...@filename, �...@created, �...@modified, �...@imported
>
> > Is this the way to go,  or is there some "Ruby Way"?
>
> > I'm running:
> > ruby 1.8.6
> > Rails 2.2.1
>
> > Thanks in Advance,
> > Richard
>
> --http://jeremymcanally.com/http://entp.com/http://omgbloglol.com
>
> My books:http://manning.com/mcanally/http://humblelittlerubybook.com/(FREE!)
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Linking in SSL page to non SSL

2008-12-15 Thread Nik B

I have a situation where I am generating links in an SSL secured area
(no subdomain) to a non SSL page (with a subdomain). The certificate
doesn't cover subdomains, so everytime someone clicks on the link to a
https:// page where SSL isn't allowed there is a certificate error.

Now users can click okay, and then they are redirected to the http://
page, but I would like to create the link directly to http:// rather
than https://

I'm using the ssl_requirement plugin. Is there a way to do this?

Thanks,
N
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Params error with: complex form+multiple models

2008-12-15 Thread Hassan Schroeder

On Sun, Dec 14, 2008 at 5:14 PM, David Sousa
 wrote:

> The question is: Should this input( id="invoice_items_attributes__item" type="text" size="30"
> name="invoice[items_attributes][][item]"/>) have a id different from the
> other ones? I

Absolutely, that's basic HTML -- an ID must be unique within a given
page. And more so if you have JavaScript acting on things via ID.

FWIW,
-- 
Hassan Schroeder  hassan.schroe...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Scaffold leads to OK database, but model empty

2008-12-15 Thread Hassan Schroeder

On Mon, Dec 15, 2008 at 8:12 AM, Jeremy McAnally
 wrote:
>
> ActiveRecord automatically discovers the fields in your model's table
> and creates accessor methods for you at runtime, so the model shown is
> all you need.

Exactly, and

>> ruby script/generate scaffold Csv filename:string created:date
>> modified:date imported:date

..probably worth mentioning that you can easily confirm something
like this by opening your Rails console and entering e.g.
   @csv =  Csv.new
and viewing the output.

FWIW,
-- 
Hassan Schroeder  hassan.schroe...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Params error with: complex form+multiple models

2008-12-15 Thread David Sousa

So, now I know where is the error, but I still don't know how to fix it.

When I use remote_form_for, the params hash gets messed up. If I use, 
form_for, everything is sent ok. But, I want a Ajax for.

Does anyone know how to fix it?

thanks,


David Sousa
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Scaffold leads to OK database, but model empty

2008-12-15 Thread Jeremy McAnally

ActiveRecord automatically discovers the fields in your model's table
and creates accessor methods for you at runtime, so the model shown is
all you need.

--Jeremy

On Mon, Dec 15, 2008 at 10:03 AM, RichardOnRails
 wrote:
>
> Hi,
>
> I ran:
> ruby script/generate scaffold Csv filename:string created:date
> modified:date imported:date
> rake db:migrate
> sqlite3 db\development.sqlite3
>.dump csvs (database columns displayed as expected)
> type app\models\csv.rb (which displayed only:
>class Csv < ActiveRecord::Base
>end
> with no field names)
>
> I'm inclined to just populate the latter with:
>@filename,  @created,  @modified,  @imported
>
> Is this the way to go,  or is there some "Ruby Way"?
>
> I'm running:
> ruby 1.8.6
> Rails 2.2.1
>
> Thanks in Advance,
> Richard
> >
>



-- 
http://jeremymcanally.com/
http://entp.com/
http://omgbloglol.com

My books:
http://manning.com/mcanally/
http://humblelittlerubybook.com/ (FREE!)

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Multiple Models, one form, has_many AND has_one not workink

2008-12-15 Thread Darran Thompson

I have a model (Employee) which has a has_many association with
(FlatMate). A flat mate also has a has_one association (PrimaryAddress).
Now when I try to create a form and then submit it I receive the 500
expected hash error.

Can anyone help me out?

Here's my view:

<% form_for [:admin, @employee] do |f| %>

  <%= render :partial => 'essential_details', :locals => { :f => f } %>
  <%= render :partial => 'next_of_kin', :locals => { :kin =>
@employee.kin } %>

  <%=
  #render :partial => 'flat_mate', :collection => @employee.flat_mates
  %>

  <% @employee.flat_mates.each_with_index do |flat_mate, index| %>

Contact #
<% fields_for "employee[flat_mate_attributes][#{index}]", flat_mate
do |fm_form| %>
  full name: 
  <%= fm_form.text_field :first_name, :size => 25, :index => nil %>
  <%= fm_form.text_field :initial, :size => 2, :index => nil %>
  <%= fm_form.text_field :surname, :size => 25, :index => nil %>

  <%= do_error flat_mate, :first_name %> <%= do_error flat_mate,
:surname %>

  relationship:
  <%= fm_form.select :relationship, ['Partner', 'Friend',
'Flatmate'], :prompt => true, :index => nil %>

  <% fields_for
"employee[flat_mate_attributes][#{index}][primary_address_attributes]",
flat_mate.primary_address do |address_form| %>
<%= address_form.hidden_field :address_type, :value => 'Main' %>

street:
<%= address_form.text_field :street %>

city/town:
<%= address_form.text_field :city %>

zip/post code:
<%= address_form.text_field :post_code %>

state/county:
<%= address_form.text_field :county %>

country:
<%= address_form.country_select :country, ['United Kingdom',
'Northern Ireland', 'Ireland', 'United States'] %>
  <% end %>
<% end %>

Phone
<%= render :partial => 'admin/shared/primary_telephone_number',
:locals => { :telephone => flat_mate.primary_telephone_number } %>

<% unless flat_mate.new_record? %>
  <%= fm_form.hidden_field :id, :index => nil %>
  <%= fm_form.hidden_field :should_destroy, :index => nil, :class =>
'should_destroy' %>
<% end %>
  <% end %>

  <%= render :partial => 'user_details', :locals => { :user =>
@employee.user } %>

  <%= submit_tag 'create' %>
<% end %>
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Scaffold leads to OK database, but model empty

2008-12-15 Thread RichardOnRails

Hi,

I ran:
ruby script/generate scaffold Csv filename:string created:date
modified:date imported:date
rake db:migrate
sqlite3 db\development.sqlite3
.dump csvs (database columns displayed as expected)
type app\models\csv.rb (which displayed only:
class Csv < ActiveRecord::Base
end
with no field names)

I'm inclined to just populate the latter with:
@filename,  @created,  @modified,  @imported

Is this the way to go,  or is there some "Ruby Way"?

I'm running:
ruby 1.8.6
Rails 2.2.1

Thanks in Advance,
Richard
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] RoR survey (research of the Utrecht University)

2008-12-15 Thread Maarten

Dear Rails developers,

On behalf of the Utrecht University (in the Netherlands) I would like
to invite you to complete a survey on your perception of the Ruby on
Rails framework. The goal of this research is to design a model that
explains and predicts the adoption of Ruby on Rails by web application
developers in the enterprise environment.

The survey is aimed at professional web application developers.
Experience with Ruby on Rails is not necessary.

The survey consists of two pages of questions and it will take less
than 10 minutes to complete it. You can participate anonymously or you
can choose to leave your email address at the end of the survey if you
would like to receive a copy of the final results of this research.

The survey can be found here: www.cs.uu.nl/survey/ror

I would really appreciate it if you would help me finish my thesis
research. Thank you!

Kind regards,

Maarten Nefkens

mrnef...@cs.uu.nl

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] API versioning strategy

2008-12-15 Thread Zac Zheng

I am developing a service to be accessed within a browser and via API. I
am not sure what the best practise for API versioning is.

AdWords API split into major version by URI mutilation: /v1, /v2 etc.

My current thoughts are:

Website accessible from www.myservice.com
API accessible from v1.myserviceapi.com This will be a separate instance
with its own mongrels/mod_rails.

Major updates will go under a incremented subdomain,
v2.myserviceapi.com. This will happen infrequently. Perhaps once a year.

Minor updates will be a normal capistrano deploy.

Can anyone please comment on the above? It's much appreciated.

Zac
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: HTML in db columns

2008-12-15 Thread Hassan Schroeder

On Mon, Dec 15, 2008 at 5:45 AM, Don French  wrote:
>
> The column is a text type. I get   but not  The bullets
> are just left out.

"bullets" are a visual attribute of OL/LI defined by the page's CSS; are
you sure your style sheet isn't overriding the default browser view, or
causing the bullets to be hidden by another element?

OTOH, if you can't see the OL/LIs in a page via `view source` I think
you'll need to post some code.

-- 
Hassan Schroeder  hassan.schroe...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: user + author in one model or not

2008-12-15 Thread Jeremy Weiskotten

Petr Bobek wrote:
> I was planning to create subdomain for each author, so I want to 
> seperate them from the normal users.
> 
> 
> 
> Maurício Linhares wrote:
>> Why does it need to be a type? What makes an author so different to
>> make it different from a common user?

You could use a type column, and single table inheritance, but I suggest 
creating a separate Author model with its own authors table, and have a 
user_id in that table. This way, an Author belongs_to a User. All 
author-specific data goes in the authors table, and you can reuse all of 
your authentication with the User model.

Alternatively, users could have an author_id, if that makes more sense.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Doozy of a pagination problem

2008-12-15 Thread Joe Peck

Hey,

This is sort of complicated, and I'm trying to keep it as simple as I
can.

I'm using will_paginate to display only 25 snapshots on each page.  My
question is how can I return only the most recent snapshot per link
(just one per link)?

@snapshots = Snapshot.paginate :order => 'snapshots.weighted_score
desc', :conditions => ["snapshots.scenario_id = ? and (links.status = 1
or links.status = 2 or links.status = 4)", @scenario.id], :include =>
[:page, :link, {:snapshot_attributes => :attribute}], :page =>
params[:page], :per_page => 25

Let me know if any other information is needed, and thanks for any
advice.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: link_to and routing question

2008-12-15 Thread Patrick Doyle
>
> > what does the output of:
> >
> > rake routes
> >
> > look like?
> >
> > --wpd
>
>roles GET/roles
> {:action=>"index", :controller=>"roles"}
>   formatted_roles GET
> /roles.:format
> {:action=>"index", :controller=>"roles"}
>   POST   /roles
> {:action=>"create", :controller=>"roles"}
>   POST
> /roles.:format
> {:action=>"create", :controller=>"roles"}
>  new_role GET/roles/new
> {:action=>"new", :controller=>"roles"}
>formatted_new_role GET
> /roles/new.:format
> {:action=>"new", :controller=>"roles"}
> edit_role GET
> /roles/:id/edit
> {:action=>"edit", :controller=>"roles"}
>   formatted_edit_role GET
> /roles/:id/edit.:format
> {:action=>"edit", :controller=>"roles"}
>  role GET/roles/:id
> {:action=>"show", :controller=>"roles"}
>formatted_role GET
> /roles/:id.:format
> {:action=>"show", :controller=>"roles"}
>   PUT/roles/:id
> {:action=>"update", :controller=>"roles"}
>   PUT
> /roles/:id.:format
> {:action=>"update", :controller=>"roles"}
>   DELETE /roles/:id
> {:action=>"destroy", :controller=>"roles"}
>   DELETE
> /roles/:id.:format
> {:action=>"destroy", :controller=>"roles"}
>  {:action=>"wsdl"}
>
>  /:controller/:action/:id.:format
>
>  /:controller/:action/:id
>
> In all my humble newbieness, it looks to me like, when you get a URL of the
form /roles/something?with_this?and_that, the first pattern that the route
table finds that matches that is the pattern that looks like: /roles/:id, so
you get routed to the "show" action of the "roles"controller.  I know that
the routes table is processed in order and the first pattern that matches is
the one that triggers the action (which is why the /:controller/:action/:id
pattern is always listed last.).

What I don't know is, why does {:action => "remove_role_from_account",
:role_id => role, :account_id => @account} produce a url of the form:
/roles/remove_role_from_account, when you specifically plug in an action of
"remove_role_from_account".

Sorry if this doesn't help much.

--wpd

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problems with session store and local host

2008-12-15 Thread James Byrne

Frederick Cheung wrote:

> Come, on this is open source after all :-) 

Yes, but the problem was with my code, not his.

  def new
@user = User.new(params[:user])
if @user.save
  flash[:notice] = 'User Account Added'
  redirect_back_or_default account_url
else
  render :action => new
end
  end

Should have been.

  def new
@user = User.new
  end

Somehow I ended up coding a create method and labelling it as new.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: object to hash

2008-12-15 Thread Hamza Khan-cheema

Frederick Cheung wrote:
> On 6 Mar 2008, at 09:51, Daniel Van den oord wrote:
> 
>> structure
>> so I can't do the following:
>>
>> result = RestfullPerson.new(@person)
>>
>> I can't get any to_hash methods to work. any ideas are welcome
> 
> I'm not 100% sure i've understood your question, but is
> @person.attributes what you're after ?
> 
> Fred

Thanks Fred.

This is exactly what I was looking for.  You might also want to point 
out that you can also do this

@person.attributes.to_options!

That will symbolize the keys, to make it look like the params[] field 
that is passed to the controller

Kind Regards
Hamza
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: link_to and routing question

2008-12-15 Thread Allen Walker

Patrick Doyle wrote:
> On Sun, Dec 14, 2008 at 10:27 PM, Allen Walker <
> rails-mailing-l...@andreas-s.net> wrote:
> 
>>
>> {:action=>"wsdl"} /:controller/:action/:id.:format
>>  /:controller/:action/:id
>>
>> So it's not hitting my action "remove_role_from_account" and instead is
>> try to go to action "show" with the id as "remove_role_from_account"
>>
>> what am i doing wrong here?
>> --
>>
> what does the output of:
> 
> rake routes
> 
> look like?
> 
> --wpd

   roles GET/roles 
{:action=>"index", :controller=>"roles"}
   formatted_roles GET 
/roles.:format 
{:action=>"index", :controller=>"roles"}
   POST   /roles 
{:action=>"create", :controller=>"roles"}
   POST 
/roles.:format 
{:action=>"create", :controller=>"roles"}
  new_role GET/roles/new 
{:action=>"new", :controller=>"roles"}
formatted_new_role GET 
/roles/new.:format 
{:action=>"new", :controller=>"roles"}
 edit_role GET 
/roles/:id/edit 
{:action=>"edit", :controller=>"roles"}
   formatted_edit_role GET 
/roles/:id/edit.:format 
{:action=>"edit", :controller=>"roles"}
  role GET/roles/:id 
{:action=>"show", :controller=>"roles"}
formatted_role GET 
/roles/:id.:format 
{:action=>"show", :controller=>"roles"}
   PUT/roles/:id 
{:action=>"update", :controller=>"roles"}
   PUT 
/roles/:id.:format 
{:action=>"update", :controller=>"roles"}
   DELETE /roles/:id 
{:action=>"destroy", :controller=>"roles"}
   DELETE 
/roles/:id.:format 
{:action=>"destroy", :controller=>"roles"}
 {:action=>"wsdl"}
  
/:controller/:action/:id.:format
  
/:controller/:action/:id

-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Trying to track down an issue in a performance based load test.. using Rails 2.2.2

2008-12-15 Thread Jay

 I am trying to debug an issue with Rails 2.2.2... I am running a load
test where I am logging in and out 20 users, and I am occasionally
seeing this error, in my logs:  (see stack trace below)  it appears
that the body of some of my requests are null... I'm trying to figure
out if a) it's a rails issue, b) is it a jruby/rack issue or c) is it
an issue with caching (which is turned on but I wouldn't think should
be an issue on a login/logout scenario).  any one have any thoughts on
where I Could check to see why the body is null?  I'm off to try and
turn off caching to see what happens but this issue is a pretty big
issue and we need to resolve it asap.  We see it in normal usage of
our website too.  It appears to be timing related but I'm not sure why
or how yet.

I'm not necessarily looking for THE answer but any general help of
"check xxx" would be great.

Thanks!
Jay






[#|2008-12-11T16:14:13.299-0500|INFO|sun-appserver9.1|
javax.enterprise.system.container.web|
_ThreadID=16;_ThreadName=httpWorkerThread-8081-1;|PWC1412: WebModule[]
ServletContext.log():/!\ FAILSAFE /!\  Thu Dec 11 16:14:13 -0500 2008
  Status: 500 Internal Server Error
  undefined method `[]' for nil:NilClass
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:597:in `clean_up_ajax_request_body!'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:508:in
`parse_formatted_request_parameters'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:441:in `request_parameters'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:392:in `parameters'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:30:in `request_method'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/
activesupport-2.2.2/lib/active_support/memoizable.rb:86:in
`request_method'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/request.rb:40:in `method'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/routing/route_set.rb:433:in
`extract_request_environment'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/routing/route_set.rb:386:in `recognize'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/dispatcher.rb:182:in `handle_request'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/dispatcher.rb:120:in `dispatch'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/
applications/j2ee-modules/WebSite/WEB-INF/gems/gems/actionpack-2.2.2/
lib/action_controller/dispatcher.rb:39:in `dispatch'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
jsp/j2ee-modules/WebSite/loader/rack/adapter/rails.rb:37:in
`serve_rails'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
jsp/j2ee-modules/WebSite/loader/rack/adapter/rails.rb:44:in `call'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
jsp/j2ee-modules/WebSite/loader/jruby/rack/rails.rb:145:in `call'
/Applications/NetBeans/glassfish-v2ur2/domains/domain1/generated/
jsp/j2ee-modules/WebSite/loader/rack/handler/servlet.rb:17:in `call':1
|#]

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: user + author in one model or not

2008-12-15 Thread Petr Bobek

I was planning to create subdomain for each author, so I want to 
seperate them from the normal users.



Maurício Linhares wrote:
> Why does it need to be a type? What makes an author so different to
> make it different from a common user?


-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: finddef - find methods in textmate

2008-12-15 Thread jzimmek

both provide a find-method functionality (and rubyamp a lot more).

i am not very familiar with rubyamp, but looking at the code i see the
following difference:

finddef:
uses the "selected word" / "cursor position" to lookup the method
definition by pressing "^-"

rubyamp:
prompts you for a "methodname" to search for

imho is pressing "^-" much simpler than entering a complete methodname
to search for.

finddef will find method definitions in the open project, rubygems and
in an usersupplied searchpath if you wish - i have not used rubyamp,
so i do not know if this is a difference between the two.


On Dec 15, 1:59 pm, "Hunt Jon"  wrote:
> Is this different from RubyAMP's functionality?
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: HTML in db columns

2008-12-15 Thread Don French

The column is a text type. I get   but not  The bullets
are just left out.

On Dec 13, 9:46 pm, Phlip  wrote:
> Don French wrote:
> > I have some text columns where I would like many of the html commands
> > available. I can insert tags in the field with no problem and it stays
> > there. When I try to use the data like <%= @item.description %> I
> > loose several of the tags. They do not work. Particularly the 
> >   tags. The   tags work along with font and color.
>
> > Are they being filtered out automatically?
>
> Not at all - if you put raw text in you should get raw text out. (Probably 
> UTF-8...)
>
> How long is your description field? If it's not a TEXT blob, it might truncate
> at 255.
>
> What do your unit tests say about the description field, and the view it 
> constructs?
>
> > What do I need to do to get a column to display in the format
> > specified.  Ultimately I want to use one of the wysiwyg editors on the
> > site, but If I can not get the output to display, it is of no use
>
> We do it all the time.
>
> But just today I could not get a  to display its freaking list-style-type:
> disc for anything. Both Firefox and IE caught the bug. Maybe it's a lunar 
> phase
> thing, and you caught it too!
>
> --
>    Phlip
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: user + author in one model or not

2008-12-15 Thread Maurício Linhares

Why does it need to be a type? What makes an author so different to
make it different from a common user?

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Dec 15, 2008 at 10:37 AM, Petr Bobek
 wrote:
>
> Hi everybody,
>
> I am building some kind of social networking web. I have implemented
> user registration and now I would like to add another type of
> registration (authors). I dont know whether to keep the registration
> simple and add just a checkbox (user and author) and add a new column
> (user_type) into the existing user table or build a new model
> Author to manage authors.
>
> Thanks for your thoughts.
> Cheers
> Petr
> --
> 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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] user + author in one model or not

2008-12-15 Thread Petr Bobek

Hi everybody,

I am building some kind of social networking web. I have implemented
user registration and now I would like to add another type of
registration (authors). I dont know whether to keep the registration
simple and add just a checkbox (user and author) and add a new column
(user_type) into the existing user table or build a new model
Author to manage authors.

Thanks for your thoughts.
Cheers
Petr
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: doubts in running a sample web application

2008-12-15 Thread Angappan Ayyavoo

Thanks.
For ur kind reply.

 May I know which version of ruby and rails is stable.
Give me some better links to learn and work in ruby on rails.


-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Error in Mysql Connection

2008-12-15 Thread Angappan Ayyavoo

Hai

 Iam getting error in mysql connection.

C:\Ruby\addr>ruby script/server
=> Booting WEBrick...
=> Rails 2.2.2 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-12-15 18:51:18] INFO  WEBrick 1.3.1
[2008-12-15 18:51:18] INFO  ruby 1.8.6 (2008-08-11) [i386-mswin32]
[2008-12-15 18:51:18] INFO  WEBrick::HTTPServer#start: pid=988 port=3000
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install the mysql gem and try again: gem install my
127.0.0.1 - - [15/Dec/2008:18:51:24 India Standard Time] "GET /contacts/
HTTP/1.1" 500 13864
- -> /contacts/
127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET /
HTTP/1.1" 304 0
- -> /
127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
/javascripts/prototype.js HTTP/1.1" 304 0
http://localhost:3000/ -> /javascripts/prototype.js
127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
/javascripts/effects.js HTTP/1.1" 304 0
http://localhost:3000/ -> /javascripts/effects.js
127.0.0.1 - - [15/Dec/2008:18:51:36 India Standard Time] "GET
/images/rails.png HTTP/1.1" 304 0
http://localhost:3000/ -> /images/rails.png
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install the mysql gem and try again: gem install my
127.0.0.1 - - [15/Dec/2008:18:51:41 India Standard Time] "GET /contacts/
HTTP/1.1" 500 13864
- -> /contacts/




and kindly give me some better links for the beginner to adapt with ruby
on rails ( Latest)
Iam using ruby 1.8.6 and rails 2.2.2
or which version is better.

Guide me.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] *Looking for new clients on Software and Web Development / websites...

2008-12-15 Thread AKS

*Looking for new clients on Software and Web Development / websites
related projects – we perform it at reasonable price.

Helloo!, thanks for stopping by me my name is Aaron and About my
business (HYVA IT Solutions) Founded in 2003 is a Trans-National
Information Technology, Services, consulting and multimedia company
with Indo-UK Holding. We at Hyva have been developing website design
and software development services since 2003 and have thus acquired an
extensive expertise in software development and website design. We are
reaching people to let know globally that we take or do projects on
web development at reasonable price.

Take a look at our recently developed web experience:

http://www.svidxb.com
http://www.hkbkeducation.org/
http://kyeros.com/
http://www.anjantravels.com/
http://www.universalsystemsonline.com/
http://beatyourban.co.uk/
http://www.sanselmsstrollers.com/
http://www.federalcranes.com/
http://www.evokeindia.com/
http://www.valistone.com/
http://www.stoneparkindia.com/

When my business can be of your assistance, then please do not
hesitate to contact me (Available Online) for quick correspondence
Skype: aaron_kriss / Google Talk: aaronkriss07 / MSN:
aa...@hyvaitsolutions.com or Email me at aa...@hyvaitsolutions.com or
I am to take you call.

Best,

-   Aaron Kriss

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: finddef - find methods in textmate

2008-12-15 Thread Hunt Jon

Is this different from RubyAMP's functionality?

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Unicode problem with mb_chars.index

2008-12-15 Thread Peter

Hello,

I tried the following
str ="ÄÄa__"
assert str.mb_chars.is_utf8?
assert str.is_utf8?

# this is logical
assert_equal 4, str.index("a", 4)

# this is not logical. shouldn't this be nil !?
assert_equal 2, str.mb_chars.index("a", 4)

Why is the last line failing? And how could I fix this?

Regards,
Peter.

PS: I am using ruby 1.8.6 on linux with rails 2.2.2
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: link_to and routing question

2008-12-15 Thread Patrick Doyle
On Sun, Dec 14, 2008 at 10:27 PM, Allen Walker <
rails-mailing-l...@andreas-s.net> wrote:

>
> I have the following link_to:
>
> <%= link_to("Remove", {:action => "remove_role_from_account", :role_id
> => role, :account_id => @account}) %>
>
> It generates:
> http://myserver.com/roles/remove_role_from_account?account_id=1&role_id=5
>
> But this doesn't match the right default route:
>
> {:action=>"wsdl"} /:controller/:action/:id.:format
>  /:controller/:action/:id
>
> So it's not hitting my action "remove_role_from_account" and instead is
> try to go to action "show" with the id as "remove_role_from_account"
>
> what am i doing wrong here?
> --
>
what does the output of:

rake routes

look like?

--wpd

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Modify Session Data using session_id

2008-12-15 Thread sadeesh kumar viswanathan

Hi,
Rather than accessing a base methods directly, you can access some
class methods like 'process_cgi' to solve you pbm better I think. Try
http://api.rubyonrails.org/classes/ActionController/Base.html#M000523
this one and post here whether it helps you or not. I am also
interested in knowing this.

Thanks,
Sadeesh

On Dec 15, 4:41 pm, Jeff Vogt 
wrote:
> Hi, first post here.  I'm enjoying getting to know rails.  I have been
> scratching my head trying to find a way to modify data in a session by
> directly accessing CGI::Session.
>
> I should note, using the following code, I can successfully create a new
> key / value pair from the console, but not within my app.  I have tried
> both methods below:
>
> def add_session_data(other_sess_id, new_data)
> a =
> CGI::Session::ActiveRecordStore::Session.find_by_session_id(other_sess_id)
> a.data[:test] = new_data
> a.save
> end
>
> def add_session_data(other_sess_id, new_data)
> cgi = CGI.new("html4")
> a = CGI::Session.new(cgi, 'database_manager' =>
> CGI::Session::ActiveRecordStore, 'session_id' => other_sess_id)
> a[:test] = new_data
> a.close
> end
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: different views for a single model?

2008-12-15 Thread Bill Vatikiotis

Thank you all. It's still difficult to REST my brain but I'll get
there eventually
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Application failing on undefined method `install_gem_spec_st

2008-12-15 Thread Caps Lock

Caps Lock wrote:
> Frederick Cheung wrote:
>> On Dec 15, 5:47�am, Caps Lock 
>> wrote:
>>> Hmmm...well it is certainly trying to use my frozen rails, but why is it
>>> having issue here on the host server vs. on my development sever at
>>> another location?
>>>
>> is your version of rubygems new enough?
>> 
>> Fred

My bad on the prior post before writing anything :-/.

When doing gem --version i get 1.3.1 which, as i understand it, is the 
latest and greatest.
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Application failing on undefined method `install_gem_spec_st

2008-12-15 Thread Caps Lock

Frederick Cheung wrote:
> On Dec 15, 5:47�am, Caps Lock 
> wrote:
>> Hmmm...well it is certainly trying to use my frozen rails, but why is it
>> having issue here on the host server vs. on my development sever at
>> another location?
>>
> is your version of rubygems new enough?
> 
> Fred

-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: why is wrong with this code - the model "save!" method does not seem to give a correct response back?

2008-12-15 Thread Greg Hauptmann
great - interesting how I've been using the "transaction" model for some
months but it is only since I've had a new model that has an association
with it (i.e. the "allocation" model in this case) that I've noticed an
issue...  :)

On Mon, Dec 15, 2008 at 7:24 PM, Chris Bartlett
wrote:

>
> On Dec 15, 10:59 am, Frederick Cheung 
> wrote:
> > On 14 Dec 2008, at 21:50, Greg Hauptmann wrote:
> > >
> > > Q2 - Is there a list of  "reserved names" available somewhere one
> > > could  use as a check for model names?
> >
> > Not that I know of.
>
> http://wiki.rubyonrails.org/rails/pages/ReservedWords
> (Google is your friend.)
> >
>

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Modify Session Data using session_id

2008-12-15 Thread Jeff Vogt

Hi, first post here.  I'm enjoying getting to know rails.  I have been
scratching my head trying to find a way to modify data in a session by
directly accessing CGI::Session.

I should note, using the following code, I can successfully create a new
key / value pair from the console, but not within my app.  I have tried
both methods below:

def add_session_data(other_sess_id, new_data)
a =
CGI::Session::ActiveRecordStore::Session.find_by_session_id(other_sess_id)
a.data[:test] = new_data
a.save
end

def add_session_data(other_sess_id, new_data)
cgi = CGI.new("html4")
a = CGI::Session.new(cgi, 'database_manager' =>
CGI::Session::ActiveRecordStore, 'session_id' => other_sess_id)
a[:test] = new_data
a.close
end
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Problem please help

2008-12-15 Thread Sameera Gayan

Thorsten Mueller wrote:
> map.namespace :api do |api|
> api.resources :mobileowners
> end
> 
> should be all you need.

Hi Thorsten,

Thats IT :

it worked. thankx you saved my day

thankx again

cheers
sameera
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Asset timestamping and images referred in CSS

2008-12-15 Thread Piotr Wlodarek


Rails appends ?mtime to asset paths, which is nice.

But how to coupe with images referred in css? Example:

background-image: url(../images/bg.gif);

Idea? Plugin?


Regards,
Piotr Włodarek
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: routes.rb

2008-12-15 Thread Franz Strebel

and don't forget that you can use rake routes to see all your
available routes at any given time, and their corresponding
controllers and actions.

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: routes.rb

2008-12-15 Thread Thorsten Müller

If you nest your resources as you do, then
the url will need all parts of it like:

user_role_path(@user, role)

As parameters it takes the resource ids as default,
so you don't need the :id and the :user_id here
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Problem please help

2008-12-15 Thread Thorsten Müller

map.namespace :api do |api|
api.resources :mobileowners
end

should be all you need.
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to build index from model

2008-12-15 Thread astropanic

Thanks Man,
It works nice :)

Regards

On Dec 14, 7:46 pm, Jeremy Weiskotten  wrote:
> astropanic wrote:
> > Hi,
>
> > I have a application where I have a book model.
> > I have a book controller, it has an action named "index_titles"
>
> > What should I write in the action of this controller to get a list
> > with the distinct first letters for each book model in the view ?
>
> > For example when I have five books:
>
> > "Amazing title"
> > "Bookworm is comming"
> > "Basic for beginners"
> > "Denial of service"
> > "UPS development guide"
>
> > I will have four links in the view with the anchors "A", "B", "D" and
> > "U" respectively.
>
> > I'm a experienced PHP developer, but I'm a newcommer to Ruby. What is
> > the optimal rails way to accomplish this ?
>
> > Regards
>
> Something like this in your controller (assuming you're on Rails 2.1 or
> later):
>
> def index_titles
>   @first_letters = Book.all(:select => 'title', :order => 'title').map {
> |book| book.title.first }
> end
>
> This code fetches the title of every book (in alpha order) and extracts
> just the first letter of each title. Be sure to have an index on the
> title column.
>
> Then iterate on @first_letters in your view to render a link to each
> letter.
>
> Hope that helps!
>
> Jeremyhttp://jeronrails.blogspot.com
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Routing Problem please help

2008-12-15 Thread Sameera Gayan

Hi all,

I'm creating a REST API for one of my projects and I'm stuck in a
routing issue.

I have a resource called mobileowner (which will send the user xml when
given the mobile no)

And my controller is in the following path

app -> controllers -> api -> mobileowner.

so can someone tell me how to configure this in my routs.rb file. (to
work mobileowner as a resource).

I'm using rails 2.0.2

thankx in advance

cheers
sameera
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] routes.rb

2008-12-15 Thread Mark Moore

Hi,

I am going through a tutorial in a rails book. I have Something off with
routes:
I have RESTful resource in routes.rb:

"...
  map.resources :users, :member => { :enable => :put } do |users|
 users.resources :roles
 end
..."

and in a html.erb partial I have:
"...
<%= link_to 'assign role',
role_url(:id => role.id, :user_id => @user.id),
:method => :put %>
..."
I get:
 NoMethodError in Roles#index

Showing roles/_role.html.erb where line #9 raised:

undefined method `role_url' for #

I might be using newer version of rails than the book.  The role_url is
not an explicitly defined route in this tutorial routes.rb file, I don't
know enough about RoR, but I am guessing the role_url should be
automatically available, so I would appreciate any help with this
because my RoR learning is halted here.
Cheers,
Mark
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: doubts in running a sample web application

2008-12-15 Thread Sijo Kg

Hi
   Do like this
rails project_name
./script/generate scaffold contact
rake db:migrate
Now run the application  ./script/server
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: marshal data too short

2008-12-15 Thread Benjamin Bonnet

Hi, I ended up with this problem, but having a six hundred thousands 
records in my sessions table…
Surely've been hacked;
The site are protected with a simple login page (salt & hash, successful 
create a user session) and is just on the web for development/production 
testing.
I wonder exactly how it has happenned; The logs don't show any 
activities !!!
might be something like XSS, but if it seems obvious for some of you, 
thanks for the info you'd provide.



> For MySQL db, here is the migration to change to longtext:
> 
> [code]
> class ChangeSessions2 < ActiveRecord::Migration
>   def self.up
> execute "ALTER TABLE sessions CHANGE COLUMN data data LONGTEXT"
>   end
> 
>   def self.down
>   end
> end
> 
> [/code]
> 
> Regards,
> 
> LarryK

-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >