[Rails] sanjib dhar wants to chat

2009-12-07 Thread sanjib dhar
---

sanjib dhar wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-c6b0b759dc-c292a80d76-018225cdc3827587
You'll need to click this link to be able to chat with sanjib dhar.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with sanjib dhar, visit:
http://mail.google.com/mail/a-c6b0b759dc-c292a80d76-018225cdc3827587

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: accepts_nested_attributes_for + paperclip + polymorphic + problem

2009-12-07 Thread Abhishek shukla
 antony thanks. It worked,.

On Mon, Dec 7, 2009 at 6:11 PM, Antony Sastre  wrote:

>
> Hi Ab,
>
> The form view should read:
>
> <% form_for @office, :html => {:multipart => true} do |f| %>
>
> This is always the case when dealing with file uploads.
>
>
> On Dec 7, 9:05 am, Abhishek shukla  wrote:
> > Hello Friends,
> >
> > I am not able to retrieve the value form page
> >
> > controller
> >   offices_controller
> > def new
> >  @office = Office.new
> > end
> >
> > def create
> >  @office = Office.new(params[:office])
> >  @office.save
> >end
> >  end
> >
> > VIEW
> >   <% form_for @office do |f| %>
> > <%= f.text_area :office_name %>
> > <% f.fields_for :images_attributes do |i| %>
> >  <%= i.file_field :avatar %>
> > <%end%>
> > <%= f.submit "Submit" %>
> >   <%end%>
> >
> > Model
> >
> > Office.rb
> > accepts_nested_attributes_for :image
> >
> > Image.rb
> >  belongs_to :imagable, :polymorphic => true
> >
> > PROBLEM
> >  When I press submit, the params[:office] only contain :office_name and
> > avatar is getting lost? I don;t know where excatly I am getting wrong.
> >
> > Thanks for any suggestion
> >
> > Abhis
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 - how to include a id of current model

2009-12-07 Thread sami
when you use remote_function the :with option actually expect
javascript code.
in your code remote_function helper is assuming "word_id + '=' + #
{word.id}" is
a javascript code.
so you can do any of the following two things
   :with=> "'word_id='+document.getElementById('word_id').value" where
word_id will be the id of that element
   or
   you can send it to with the :url option





On Dec 7, 11:39 pm, analogue40  wrote:
> Hi all,
>
> Hope someone can help me out with this weird problem, I'm sure it's
> something simple.
>
> All I want to do is send the ID of the current model from the view
> into the controller via a remote_function call
>
> basiclaly I'm adding a word to a list using a check box:
>
> check_box_tag "list_ids[]", list.id, list.words.include?(word),
> { :onchange => remote_function(:url => { :controller =>
> "list", :action => "add", :id => list.id }, :with => "word_id + '=' + #
> {word.id}" ) }
>
> The part which isn't working is specifically this:
>
> :with => "word_id + '=' + #{word.id}"
>
> If I remove it the code works but obviously I need that word.id in the
> controller so I know which word to add to the list.
>
> Thanks in advance!
>
> Dave

thanks

Syed Samiuzzaman
software Engineer
Code71 Inc ( www.code71.com)
product: www.scrumpad.com
blog: samiuzzaman.blogspot.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-t...@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.




Re: [Rails] Order of Join table

2009-12-07 Thread Rilindo Foster
No, just:


> weburls_platforms with  'platform_id' and 'weburl_id' fields




On Dec 7, 2009, at 9:41 PM, Conrad Taylor wrote:

> On Mon, Dec 7, 2009 at 4:35 PM, Rilindo Foster  wrote:
> That was fun.
> 
> Due to some mix-up, I ended up having to rename my models. At any event, I 
> managed to fix everything, except that I kept getting this message when I 
> attempted to delete an entry:
> 
> 
> ActiveRecord::StatementInvalid (Mysql::Error: Table 
> 'development.platforms_weburls' doesn't exist: SHOW FIELDS FROM 
> `platforms_weburls`):
> 
> The way I setup my module is that platforms and weburls are connect via the 
> has_and_belongs_to_many association. So I was expecting for the rails up to 
> look it up like:
> 
> weburls_platforms.
> 
> But no. :(
> 
> This is the second time that happened to me and in both instances, I ended up 
> having to rename the tables to get the models working (of note is that I had 
> to redo the models in the first open as well - also a hbtm relation - same 
> base table). Am I missing someplace as to how rails put together the join 
> table names? And is there a better way of addressing it? My current tables 
> don't look very consistent. >:(
> 
>  - Rilindo
> 
> --
> 
> 
> Do you have a database table called 'platforms_weburls' with 'platform_id' 
> and 'weburl_id' fields?
> 
> -Conrad
>  
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
> 
> 
> 
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Order of Join table

2009-12-07 Thread Conrad Taylor
On Mon, Dec 7, 2009 at 4:35 PM, Rilindo Foster  wrote:

> That was fun.
>
> Due to some mix-up, I ended up having to rename my models. At any event, I
> managed to fix everything, except that I kept getting this message when I
> attempted to delete an entry:
>
>
> ActiveRecord::StatementInvalid (Mysql::Error: Table
> 'development.platforms_weburls' doesn't exist: SHOW FIELDS FROM
> `platforms_weburls`):
>
> The way I setup my module is that platforms and weburls are connect via the
> has_and_belongs_to_many association. So I was expecting for the rails up to
> look it up like:
>
> weburls_platforms.
>
> But no. :(
>
> This is the second time that happened to me and in both instances, I ended
> up having to rename the tables to get the models working (of note is that I
> had to redo the models in the first open as well - also a hbtm relation -
> same base table). Am I missing someplace as to how rails put together the
> join table names? And is there a better way of addressing it? My current
> tables don't look very consistent. >:(
>
>  - Rilindo
>
> --
>
>
Do you have a database table called 'platforms_weburls' with 'platform_id'
and 'weburl_id' fields?

-Conrad


> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Silent Touch on Active Records

2009-12-07 Thread tankwanghow
Sorry I forgot to tell that I am using a dynamic multi-models form.
Using javascript to add and remove Invoice_Items. Then submit the
Invoice, and Invoice_Items the once. These resulted STALE error being
raise because every invoice_item that was change, It will :touch
the invoice record cause lock_version to change.


On Dec 7, 12:53 am, tankwanghow  wrote:
> My project uses a lot of nested attributes in many forms, and those
> model needed to be optimistically lock, using lock_version. When the
> child model get updated or added the parent model has to be :touch.
> Example would be the 'Invoice' and 'Invoice_items' scenario.
>
> Any item added, changed or deleted form the Invoice_items the Invoice
> has to be :touch(updated_at changed) and lock_version changed, in
> order optimistically lock the record.
>
> I have done this :-
>
> class InvoiceItem    belongs_to :invoice, :touch=> true
> end
>
> class Invoice    has_many :invoice_items
>   accept_nested_attributes :invoice_items, :allow_destroy => true
> end
>
> These resulted STALE error being raise because every invoice_item
> that was change, It will :touchthe invoice record once cause
> lock_version to change.
>
> I have try thehttp://github.com/UVSoft/touching_nested_attributesand
> it solve the problem. ShouldActiveRecordadd
>
>     belongs_to :invoice, :silent_touch => true
>
> as a new feature?
>
> Thank You,

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: Route error to Admin namespace

2009-12-07 Thread Paulo Coutinho
Hi.

Im already try it, but no sucess.

My controllers is not restfull.



2009/12/7 Freddy Andersen 

> This works fine for me in jruby:
>
> map.namespace(:admin) do |admin|
>  admin.resources :clients
>  admin.resources :options, :has_many => :widgets
> end
>
> Does this not work?
>
> Make sure its above the default routes...
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>


-- 
Atenciosamente,
Paulo Coutinho.
Blog: www.prsolucoes.com/blog
Site: www.prsolucoes.com
Msn:  pa...@prsolucoes.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-t...@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] invalid pointer in libxml xmlFreeNodeList

2009-12-07 Thread Simon Macneall
Hi,

Not sure if there is a better place to post this. The libxml-ruby mailing  
list doesn't have much activity.
We are getting occasional errors on our production box, that I can't  
duplicate in testing. It's not even reproducible on the production box  
with the same inputs, but I've managed to track down (via a lot of print  
statements into the Apache logs) that it is dying during the save of one  
of our models, and it appears to be during the native memory cleanup of  
libxml-ruby.

The following is appearing in the Apache error.log (we are running  
Passenger)


*** glibc detected *** Rails: /var/www/Liftronic: free(): invalid pointer:  
0x08884499 ***
=== Backtrace: =
/lib/libc.so.6[0x2b5e6e225cb8]
/lib/libc.so.6(cfree+0x76)[0x2b5e6e228276]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x221)[0x2b5e72f8d411]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x6d)[0x2b5e72f8d25d]
/usr/lib/libxml2.so.2(xmlFreeDoc+0xb8)[0x2b5e72f8d0a8]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d61ddd2]
/usr/lib/libruby1.8.so.1.8(ruby_xmalloc+0x87)[0x2b5e6d61e2b7]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d5fae72]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d5fdd22]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d605f7d]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d608b43]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d608dfa]
/usr/lib/libruby1.8.so.1.8[0x2b5e6d602cf0]

The model that is being saved has a one-many relationship with another  
model which has XML attached to it, which is being processed using libxml,  
but I can't see anything wrong in any of that code.

We are running libxml-ruby 1.1.3 and 2.6.32.dfsg-5ubuntu4.2 of libxml2,  
running on Ubuntu 9.04.

Does anyone have any suggestions on how to proceed with fixing the issue?


Cheers
Simon

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: need help for functional testing

2009-12-07 Thread sanjanad

> require File.dirname(__FILE__) + '/../test_helper'

class BooksControllerTest < ActionController::TestCase

def setup
@controller = BooksController.new
@request= ActionController::TestRequest.new
@response   = ActionController::TestResponse.new
login_as :sanj
  end

  fixtures :books

def test_should_get_index
login_as(:sanj)
get :index
assert_response :found
assert_nil assigns(:book)
  end

  def test_should_get_new
login_as(:sanj)
get :new
assert_response :found
  end
def test_should_update_book_name
login_as(:sanj)
assert_difference('Book.count',0) do
post :update, :book => {:name => "shkj"}
end
end


i guess i m assuming that i m updating the name to shjk...

but where do i check that..???

i m totallyy lost and coming up with weird doubts

but thank u all for replyin..i shall look into ur suggestions

thank u

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] testing errors!!

2009-12-07 Thread sanjanad
def test_create
num_articles = Article.count

post :create, :article => {}

assert_response :redirect
assert_redirected_to :action => 'list'

assert_equal num_articles + 1, Article.count
  end

def test_edit
get :edit, :id => 1

assert_response :success
assert_template 'edit'

assert_not_nil assigns(:article)
assert assigns(:article).valid?
end


 1) Failure:
test_create(ArticlesControllerTest) [test/functional/
articles_controller_test.rb:99]:
Expected response to be a redirect to 
but was a redirect to .

  2) Failure:
test_edit(ArticlesControllerTest) [test/functional/
articles_controller_test.rb:107]:
Expected response to be a <:success>, but was <302>

how do i solve these errors?

thank you

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Order of Join table

2009-12-07 Thread Rilindo Foster
That was fun.

Due to some mix-up, I ended up having to rename my models. At any event, I 
managed to fix everything, except that I kept getting this message when I 
attempted to delete an entry:


ActiveRecord::StatementInvalid (Mysql::Error: Table 
'development.platforms_weburls' doesn't exist: SHOW FIELDS FROM 
`platforms_weburls`):

The way I setup my module is that platforms and weburls are connect via the 
has_and_belongs_to_many association. So I was expecting for the rails up to 
look it up like:

weburls_platforms.

But no. :(

This is the second time that happened to me and in both instances, I ended up 
having to rename the tables to get the models working (of note is that I had to 
redo the models in the first open as well - also a hbtm relation - same base 
table). Am I missing someplace as to how rails put together the join table 
names? And is there a better way of addressing it? My current tables don't look 
very consistent. >:(

 - Rilindo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] how to understand Ruby/Rails code? (noting various mixins/includes) Is there a tool to assist here?

2009-12-07 Thread Hassan Schroeder
On Mon, Dec 7, 2009 at 2:53 PM, greghauptmann  wrote:

> Every rails app / gem / plugin I download the code for I seem to spend
> a good deal of time trying to make sense of the code due to the way
> Rails / Ruby is very dynamic.

> QUESTION 1:  Is there a tool that could assist here?

I've had good luck figuring out the flow of things using Kernel.caller
in logging statements added to Rails/plugin/gem code.

FWIW,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: is it ok if i define my login_as in test_helper.rb ???

2009-12-07 Thread sanjanad
thank u so much kristian :) :) i ve been trying to figure this out
from a long time..thanks :)

On Dec 5, 12:52 am, Kristian Hellquist 
wrote:
> In test_helper.rb you usually put all the global methods and data
> required, so it looks typically fine to me.
>
> Kristian Hellquist
>
> 09/12/5 sanjanad :
>
>
>
> > is it ok if i define my login_as in test_helper.rb ???
>
> > def login_as(admin)
> > @request.session[:admins] = admin ? admins(admin).id : nil
> > end
>
> > and then use login_as:sanj
>
> > in my functional tests..it does not show any errors...but is it
> > logically correct??
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] assert_redirected help

2009-12-07 Thread sanjanad
assert_redirected_to category_path(assigns(:category))

this line for example..when i use it in my code

def test_should_create_category
login_as :admin
assert_difference Category, :count, 1 do
  post :create, :category => { }
end
assert_redirected_to category_path(assigns(:category))
  end

i get an error sayin
undefined method category_path

where is this defined??

where should i define it?

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] routing requirements quick question

2009-12-07 Thread Rob Biedenharn
On Dec 7, 2009, at 2:56 PM, Clarice wrote:

> Hi everyone, first e-mail here :)
>
> I have the following in my routes.rb file.
>
> map.connect 'posts/index/:page',
>:controller => 'posts',
>:action => 'index',
>:requirements => {:page => /\d+/ },
>:page => nil
> end
>
> Does :requirements => {:page => /\d+/ } mean that if the :page
> parameter is empty this rule should not work?
>
> Thanks in advance!

Yup! You probably want two routes:

map.connect 'posts/index/:page',
:controller => 'posts',
:action => 'index',
:requirements => {:page => /\d+/ }

map.connect 'posts/index',
:controller => 'posts',
:action => 'index',
:page => nil

Or more succinctly:

map.with_options(:controller => 'posts', :action => 'index') do | 
post_index|
   post_index.connect 'posts/index/:page', :requirements => {:page => / 
\d+/}
   post_index.connect 'posts/index', :page => nil
end

-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.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-t...@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.




Re: [Rails] creating search form without Javascript

2009-12-07 Thread Hassan Schroeder
On Sat, Dec 5, 2009 at 7:52 PM, ct9a  wrote:

>  I'm trying to develop a search functionality in my application that
> caters to the non-Javascript crowd of users.

> Not wanting to use Javascript,
>
> 1) can anyone tell me how to

JavaScript.

> 2) does anyone know how to

JavaScript.

You're describing client-side behavior. That means "JavaScript"  :-)

(OK, alternatively, you could use Flash or a Java applet, but ...)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: captcha

2009-12-07 Thread RubyonRails_newbie
Cool - thanks, I'll check these out.

Cheers.

On 7 Dec, 22:59, Rick  wrote:
> captcha hasn't had any activity since Feb 2007, recaptcha shows work
> this year.
>    http://github.com/ambethia/recaptcha
>
> You might also check out the thorny_form plugin:
>    http://www.logilogi.org/pub/doc/plugins/thorny_form/
>    http://agilewebdevelopment.com/plugins/thorny_form
>    http://nedbatchelder.com/text/stopbots.html
>
> On Dec 7, 4:16 pm, Jason Roelofs  wrote:
>
>
>
> > eOn Mon, Dec 7, 2009 at 4:14 PM, RubyonRails_newbie <
>
> > craigwest...@googlemail.com> wrote:
> > > Hi all,
>
> > > I want to implement a captcha on my register page to help weed out any
> > > 'non-human' visitors.
>
> > > I was told to check outhttp://expressica.com/simple_captcha/butthe
> > > site isnt responding.
>
> > > Does anyone have any other reccomendations that are tried and tested &
> > > successful?
>
> > > Many Thanks
>
> > I'm a fan of ReCaptcha:  http://recaptcha.net/
>
> > Jason

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Route error to Admin namespace

2009-12-07 Thread Freddy Andersen
This works fine for me in jruby:

map.namespace(:admin) do |admin|
  admin.resources :clients
  admin.resources :options, :has_many => :widgets
end

Does this not work?

Make sure its above the default routes...

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: creating search form without Javascript

2009-12-07 Thread ct9a
hello?

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: captcha

2009-12-07 Thread Rick
captcha hasn't had any activity since Feb 2007, recaptcha shows work
this year.
   http://github.com/ambethia/recaptcha

You might also check out the thorny_form plugin:
   http://www.logilogi.org/pub/doc/plugins/thorny_form/
   http://agilewebdevelopment.com/plugins/thorny_form
   http://nedbatchelder.com/text/stopbots.html

On Dec 7, 4:16 pm, Jason Roelofs  wrote:
> eOn Mon, Dec 7, 2009 at 4:14 PM, RubyonRails_newbie <
>
> craigwest...@googlemail.com> wrote:
> > Hi all,
>
> > I want to implement a captcha on my register page to help weed out any
> > 'non-human' visitors.
>
> > I was told to check outhttp://expressica.com/simple_captcha/but the
> > site isnt responding.
>
> > Does anyone have any other reccomendations that are tried and tested &
> > successful?
>
> > Many Thanks
>
> I'm a fan of ReCaptcha:  http://recaptcha.net/
>
> Jason

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 understand Ruby/Rails code? (noting various mixins/includes) Is there a tool to assist here?

2009-12-07 Thread greghauptmann
Hi all,

Every rails app / gem / plugin I download the code for I seem to spend
a good deal of time trying to make sense of the code due to the way
Rails / Ruby is very dynamic.  There are various code files that are
really just ready to be "mixed in" to other files (e.g. with the class
methods & instance methods ready to go).  Just trying to make sense of
the final object structure and where methods resides seems to be a
challenge.  The latest one I've been looking at are things like
AuthLogic and Paperclip.

QUESTION 1:  Is there a tool that could assist here?  I'm thinking of
one that could do things like walk the code base and then:

* Give a hierarchy structure where various files methods are loaded
into which objects

* Given sample walk throughs of methods hit in which files for a given
controller/action (e.g. like how the java IDEs can auto-sequence
diagrams)

* Perhaps something that analyses code and then added comments to the
various files highlighting where that files methods will reside in
terms of the final object structure.

QUESTION  2: Should of nothing be available for the above, and tips/
tricks people have re understanding a new plugin/gem codebase?

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-t...@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.




Re: [Rails] Route error to Admin namespace

2009-12-07 Thread Paulo Coutinho
I make a solution that work fine to me, but i have to create one for each
controller:

# clients
map.admin_clients '/admin/clients/:action/:id', :controller =>
'/admin/clients'

...



2009/12/7 Paulo Coutinho 

> Hum. Ok.
>
> The last solution doesn't work, so i think that i'll have to make a route
> to each controller :(
>
> Do you make one route by controller? Can you post an example about how i
> can redirect all from "admin/clients" to correct controller/action/id ?
>
>
>
>
> 2009/12/7 Kristian Hellquist 
>
>> > But my system is an ERP, i have more than 20 controllers.
>>
>> >
>> > I have to make it for all controllers and actions?
>>
>> I have an application with something like 20 controllers and make all
>> routes explicit for each controller.
>>
>> >
>> > My actions is in portuguese, not "edit" but "alterar"... i put here an
>> > example of my structure.
>> >
>> > Dont have other method? A route that redirect all with "admin/" to
>> > "admin/:controller/:action/:id" ???
>> >
>>
>> You could probably do
>>
>> map.with_options(:namespace => "admin") do |admin|
>>  admin.connect ':controller/:action/:id'
>> 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-t...@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.
>>
>>
>>
>
>
> --
> Atenciosamente,
> Paulo Coutinho.
> Blog: www.prsolucoes.com/blog
> Site: www.prsolucoes.com
> Msn:  pa...@prsolucoes.com
>



-- 
Atenciosamente,
Paulo Coutinho.
Blog: www.prsolucoes.com/blog
Site: www.prsolucoes.com
Msn:  pa...@prsolucoes.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-t...@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.




Re: [Rails] Route error to Admin namespace

2009-12-07 Thread Paulo Coutinho
Hum. Ok.

The last solution doesn't work, so i think that i'll have to make a route to
each controller :(

Do you make one route by controller? Can you post an example about how i can
redirect all from "admin/clients" to correct controller/action/id ?




2009/12/7 Kristian Hellquist 

> > But my system is an ERP, i have more than 20 controllers.
> >
> > I have to make it for all controllers and actions?
>
> I have an application with something like 20 controllers and make all
> routes explicit for each controller.
>
> >
> > My actions is in portuguese, not "edit" but "alterar"... i put here an
> > example of my structure.
> >
> > Dont have other method? A route that redirect all with "admin/" to
> > "admin/:controller/:action/:id" ???
> >
>
> You could probably do
>
> map.with_options(:namespace => "admin") do |admin|
>  admin.connect ':controller/:action/:id'
> 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-t...@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.
>
>
>


-- 
Atenciosamente,
Paulo Coutinho.
Blog: www.prsolucoes.com/blog
Site: www.prsolucoes.com
Msn:  pa...@prsolucoes.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-t...@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.




Re: [Rails] captcha

2009-12-07 Thread Jason Roelofs
eOn Mon, Dec 7, 2009 at 4:14 PM, RubyonRails_newbie <
craigwest...@googlemail.com> wrote:

> Hi all,
>
> I want to implement a captcha on my register page to help weed out any
> 'non-human' visitors.
>
> I was told to check out http://expressica.com/simple_captcha/ but the
> site isnt responding.
>
> Does anyone have any other reccomendations that are tried and tested &
> successful?
>
> Many Thanks



I'm a fan of ReCaptcha:  http://recaptcha.net/

Jason

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] captcha

2009-12-07 Thread RubyonRails_newbie
Hi all,

I want to implement a captcha on my register page to help weed out any
'non-human' visitors.

I was told to check out http://expressica.com/simple_captcha/ but the
site isnt responding.

Does anyone have any other reccomendations that are tried and tested &
successful?

Many 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-t...@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.




Re: [Rails] Route error to Admin namespace

2009-12-07 Thread Kristian Hellquist
> But my system is an ERP, i have more than 20 controllers.
>
> I have to make it for all controllers and actions?

I have an application with something like 20 controllers and make all
routes explicit for each controller.

>
> My actions is in portuguese, not "edit" but "alterar"... i put here an
> example of my structure.
>
> Dont have other method? A route that redirect all with "admin/" to
> "admin/:controller/:action/:id" ???
>

You could probably do

map.with_options(:namespace => "admin") do |admin|
 admin.connect ':controller/:action/:id'
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-t...@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 requirements quick question

2009-12-07 Thread Clarice
Hi everyone, first e-mail here :)

I have the following in my routes.rb file.

map.connect 'posts/index/:page',
:controller => 'posts',
:action => 'index',
:requirements => {:page => /\d+/ },
:page => nil
end

Does :requirements => {:page => /\d+/ } mean that if the :page
parameter is empty this rule should not work?

Thanks in advance!


--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Route error to Admin namespace

2009-12-07 Thread Paulo Coutinho
Hi.

But my system is an ERP, i have more than 20 controllers.

I have to make it for all controllers and actions?

My actions is in portuguese, not "edit" but "alterar"... i put here an
example of my structure.

Dont have other method? A route that redirect all with "admin/" to
"admin/:controller/:action/:id" ???




2009/12/7 Kristian Hellquist 

> 2009/12/6 Paulo Coutinho :
> > Hi.
> >
> > Your solution dont solve.
> >
> > But i try it:
> >
> > map.with_options(:namespace => "admin") do |admin|
> >   admin.clients_index 'admin/clients', :controller => 'clients' #im
> on
> > admin so dont need redirect to "admin/clients" only "clients"
> > end
> >
> > And to the index(home) action, it is OK, but for the others actions, NO
> > (insert/delete/edit).
> >
> > This solution is near, but have to put all action do controller
> "clients".
> >
> > Any ideia?
>
> Oh my mistake ... :)
>
> map.with_options(:namespace => "admin") do |admin|
>   admin.clients_index 'clients', :controller => 'clients', :action =>
> 'index'
>  admin.clients_edit 'clients/:id/edit', :controller => 'clients',
> :action => 'edit'
>  admin.clients_insert 'clients/insert', :controller => 'clients',
> :action => 'insert',  :conditions => { :method => :post }
> end
>
> Hint: Your actions looks to match the resource-pattern
>
>
> >
> >
> > --
> > Atenciosamente,
> > Paulo Coutinho.
> > Blog: www.prsolucoes.com/blog
> > Site: www.prsolucoes.com
> > Msn:  pa...@prsolucoes.com
> >
> >
> > 2009/12/6 Kristian Hellquist 
> >>
> >> > But local and on my server(passenger) it is ok, and function normal,
> but
> >> > on
> >> > JRUBY i get an error because it is thinking that "admin" is a
> controller
> >> > and
> >> > "clients" is a action of "admin".
> >> >
> >> > My controllers is not restfull, so what i have to do, to correct it?
> Or
> >> > what
> >> > the best method to make the "admin"? I have to put any route?
> >>
> >> I have an admin section in jruby application. Try to set the routes
> >> explicit with an admin namespace.
> >>
> >> map.with_options(:namespace => "admin") do |admin|
> >>  admin.resources :clients
> >>  # or in non restful-pattern
> >>  admin.clients_index 'clients', :controller => 'admin/clients',
> >> :action => 'index'
> >> 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-t...@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.
> >>
> >>
> >
> >
> >
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@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.
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>


-- 
Atenciosamente,
Paulo Coutinho.
Blog: www.prsolucoes.com/blog
Site: www.prsolucoes.com
Msn:  pa...@prsolucoes.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-t...@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: hpricot on mac os 10.6

2009-12-07 Thread Frederick Cheung


On Dec 7, 2:33 am, timr  wrote:
> Could anyone help me get hpricot working on mac os 10.6.2 (ruby
> version 1.9.2)?
>
> Example install is provided. The hpricot_scan bundle is apparently not
> the correct architecture. I don't know what to do about that since I
> tried providing the architecture during the gem install.

is the architecture you specified the right architecture (ie is your
ruby x86_64 ) ?

Fred
> Thanks in advance,
> Tim
>
> Tim:~/Desktop/RubyClub> sudo env ARCHFLAGS="-arch i386" gem install
> why-hpricot --sourcehttp://gems.github.com
> Building native extensions.  This could take a while...
> Successfully installed why-hpricot-0.7.229
> 1 gem installed
> Installing ri documentation for why-hpricot-0.7.229...
> Installing RDoc documentation for why-hpricot-0.7.229...
> Tim:~/Desktop/RubyClub> gem which hpricot
> (checking gem why-hpricot-0.7.229 for hpricot)
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb
> Tim:~/Desktop/RubyClub> ruby -e 'require "hpricot"'
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `require': dlopen(/usr/local/lib/ruby19/gems/1.9.1/
> gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle, 9): no suitable
> image found.  Did find: (LoadError)
>         /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot_scan.bundle: mach-o, but wrong architecture - /usr/local/lib/
> ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle
>         from /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `'
>         from -e:1:in `require'
>         from -e:1:in `'

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: Problem with activesupport version

2009-12-07 Thread Srdan Dukic
2009/12/4 Matt Jones 

> Why is Rails 2.1.0 frozen in /home/srdan/rails/authlogic_example/
> vendor/rails? That's what's causing the problem. The error is caused
> by authlogic specifying a dependency on activesupport, which wasn't
> properly stubbed in the gem index back in 2.1.0 (see
> https://rails.lighthouseapp.com/projects/8994/tickets/1107 for more
> details).
>
> --Matt Jones
>
> On Dec 2, 3:20 pm, Srdan Dukic  wrote:
> > The output with the --trace commmand is as follows:
> >
> > sr...@srdan-laptop:~/rails/authlogic_example$ sudo rake --trace
> gems:install
> > (in /home/srdan/rails/authlogic_example)
> > ** Invoke gems:install (first_time)
> > ** Invoke gems:base (first_time)
> > ** Execute gems:base
> > ** Invoke environment (first_time)
> > ** Execute environment
> > rake aborted!
> > can't activate activesupport (>= 0, runtime), already activated
> > activesupport-2.1.0
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>
Hi,

>From the link that you sent, the fix seems to be to add the line:

Gem.source_index.add_spec(Gem.loaded_specs[stub])

To 'initializer.rb'. I've tried adding this line to
'/var/lib/gems/1.8/gems/rails-2.3.4/lib/initializer.rb'.

Adding it to the file gave the following error:

$ rake gems:install --trace
(in /home/srdan/rails/authlogic_example)
** Invoke gems:install (first_time)
** Invoke gems:base (first_time)
** Execute gems:base
** Invoke environment (first_time)
** Execute environment
rake aborted!
can't activate activesupport (>= 0, runtime), already activated
activesupport-2.1.0
/usr/lib/ruby/1.8/rubygems.rb:149:in `activate'
/usr/lib/ruby/1.8/rubygems.rb:165:in `activate'
/usr/lib/ruby/1.8/rubygems.rb:164:in `each'
/usr/lib/ruby/1.8/rubygems.rb:164:in `activate'
/usr/lib/ruby/1.8/rubygems.rb:49:in `gem'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:32:in
`add_load_paths'
/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/inflector.rb:283:in
`to_proc'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:242:in
`each'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:242:in
`add_gem_load_paths'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:115:in
`process'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:93:in
`send'
/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:93:in
`run'
/home/srdan/rails/authlogic_example/config/environment.rb:13
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in'
/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
/home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/misc.rake:3
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/gems.rake:15
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:518:in `invoke_prerequisites'
/usr/lib/ruby/1.8/rake.rb:1183:in `each'
/usr/lib/ruby/1.8/rake.rb:1183:in `send'
/usr/lib/ruby/1.8/rake.rb:1183:in `each'
/usr/lib/ruby/1.8/rake.rb:515:in `invoke_prerequisites'
/usr/lib/ruby/1.8/rake.rb:507:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1909:in `each'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1903:in `to

[Rails] Re: hpricot on mac os 10.6

2009-12-07 Thread Rick
Not sure about why-hpricot but hpricot (0.8.2) runs under ruby 1.9.2

$ ruby --version
ruby 1.9.2dev (2009-10-18 trunk 25393) [powerpc-darwin9.8.0]

As you can see from the above, I'm running ppc / osx 10.5.8 so no
guidance specific to intel/10.6.

You might try ...gem install hpricot

Also, don't know if you're aware but here are some links from the
hpricot README:

-
First, here are all the links you need to know:

* http://wiki.github.com/hpricot/hpricot is the Hpricot wiki and
  http://github.com/hpricot/hpricot/issues is the bug tracker.
  Go there for news and recipes and patches. It's the center of
activity.
* http://github.com/hpricot/hpricot is the main Git
  repository for Hpricot. You can get the latest code there.
* See COPYING for the terms of this software. (Spoiler: it's
absolutely free.)

If you have any trouble, don't hesitate to contact the author. As
always, I'm
not going to say "Use at your own risk" because I don't want this
library to be
risky. If you trip on something, I'll share the liability by repairing
things
as quickly as I can. Your responsibility is to report the
inadequacies.
-

good luck

On Dec 6, 9:33 pm, timr  wrote:
> Could anyone help me get hpricot working on mac os 10.6.2 (ruby
> version 1.9.2)?
>
> Example install is provided. The hpricot_scan bundle is apparently not
> the correct architecture. I don't know what to do about that since I
> tried providing the architecture during the gem install.
> Thanks in advance,
> Tim
>
> Tim:~/Desktop/RubyClub> sudo env ARCHFLAGS="-arch i386" gem install
> why-hpricot --sourcehttp://gems.github.com
> Building native extensions.  This could take a while...
> Successfully installed why-hpricot-0.7.229
> 1 gem installed
> Installing ri documentation for why-hpricot-0.7.229...
> Installing RDoc documentation for why-hpricot-0.7.229...
> Tim:~/Desktop/RubyClub> gem which hpricot
> (checking gem why-hpricot-0.7.229 for hpricot)
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb
> Tim:~/Desktop/RubyClub> ruby -e 'require "hpricot"'
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `require': dlopen(/usr/local/lib/ruby19/gems/1.9.1/
> gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle, 9): no suitable
> image found.  Did find: (LoadError)
>         /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot_scan.bundle: mach-o, but wrong architecture - /usr/local/lib/
> ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle
>         from /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `'
>         from -e:1:in `require'
>         from -e:1:in `'

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] remote_function - how to include a id of current model

2009-12-07 Thread Frederick Cheung

On 7 Dec 2009, at 16:39, analogue40 wrote:

> Hi all,
> 
> Hope someone can help me out with this weird problem, I'm sure it's
> something simple.
> 
> All I want to do is send the ID of the current model from the view
> into the controller via a remote_function call
> 
> basiclaly I'm adding a word to a list using a check box:
> 
> check_box_tag "list_ids[]", list.id, list.words.include?(word),
> { :onchange => remote_function(:url => { :controller =>
> "list", :action => "add", :id => list.id }, :with => "word_id + '=' + #
> {word.id}" ) }
> 

First off, you could just include word_id in the :url options. If you do want 
to use :with then the value needs to be a fragment of javascript that evaluates 
to an appropriate bit of query string - I've got some examples here: 
http://www.spacevatican.org/2008/5/17/with-or-without-you-link_to_remote-s-mysterio

Fred
> The part which isn't working is specifically this:
> 
> :with => "word_id + '=' + #{word.id}"
> 
> If I remove it the code works but obviously I need that word.id in the
> controller so I know which word to add to the list.
> 
> Thanks in advance!
> 
> Dave
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
> 
> 

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Secure receipt generation

2009-12-07 Thread icke
This seems to have done the trick.

class DocumentController < ApplicationController

  def show
fingerprint = params[:id]
if doc = Document.find_by_fingerprint(fingerprint)
  render :file => doc.filepath, :content_type => content_type
(doc.filename)
else
  raise ArgumentError, "Invalid document fingerprint, possible
tampered URL"
end
  end

  def download
fingerprint = params[:id]
if doc = Document.find_by_fingerprint(fingerprint)
  send_file doc.filepath, :type  => content_type(doc.filename)
else
  raise ArgumentError, "Invalid document fingerprint, possible
tampered URL"
end
  end

  protected

  def content_type(filename)
extname = File.extname(filename)[1..-1]
mime_type = Mime::Type.lookup_by_extension(extname)
content_type = mime_type.to_s unless mime_type.nil?
  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-t...@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: setting response.headers is non-effective?

2009-12-07 Thread CoolAJ86
> Use = for assignment, not ==

Thank you!

What I needed was a fresh set of eyes!

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 - how to include a id of current model

2009-12-07 Thread analogue40
Hi all,

Hope someone can help me out with this weird problem, I'm sure it's
something simple.

All I want to do is send the ID of the current model from the view
into the controller via a remote_function call

basiclaly I'm adding a word to a list using a check box:

check_box_tag "list_ids[]", list.id, list.words.include?(word),
{ :onchange => remote_function(:url => { :controller =>
"list", :action => "add", :id => list.id }, :with => "word_id + '=' + #
{word.id}" ) }

The part which isn't working is specifically this:

:with => "word_id + '=' + #{word.id}"

If I remove it the code works but obviously I need that word.id in the
controller so I know which word to add to the list.

Thanks in advance!

Dave

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: link_to_function or button_to_function memory usage

2009-12-07 Thread Chris Habgood
It is all ajax and it never complete out.  It looks like it is in a loop
generating each partial over and over again.  when it finally times out it
says it cannot allocate memory.  Is there any way around this so I do not
have to make ajax calls for those 2 actions as it is not really necessary?

On Mon, Dec 7, 2009 at 11:13 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Dec 7, 4:28 pm, Me  wrote:
> > ok maybe not enough detail.
> >
> > When a user selects a person from a drop down selection  it shows the
> > user below with 2 options, to edit the user or delete the user
> >
> > <%= link_to_function 'Edit Contact' do |page|
> >page[:showcontact].replace_html :partial => '/contacts/
> > ajaxshoweditcontact'
> >  end %>
> >
> > Inside the ajaxshoweditcontact there is this link top cancel the edit:
> >
> > <%= button_to_function 'Cancel' do |page|
> >   page[:showcontact].replace_html :partial => '/contacts/
> > ajaxshowcontact'
> > end %>
> >
> > Is it generating the partials for both links when I go to the show
> > page above?
> >
>
> yes - it is generating the partials and including them in the page -
> if you look at the source of the page you'd see something like
>
> Element.update('showcontact', 'long html string here')
>
> Fred
>
> > On Dec 6, 5:46 pm, Me  wrote:
> >
> >
> >
> > > I have an full ajax app doing crud operations for contact info for one
> > > section.  I was using ajax calls to edit and cancel and also to add a
> > > contact.  I am implementing a button_to_function instead of doing an
> > > ajax call to just edit/add/or cancel a contact.  I am running into a
> > > memory issue using the button_to_function or link_to_function.
> >
> > > I have this:
> >
> > > <%= link_to_function 'Edit Contact' do |page|
> > >   page[:showcontact].replace_html :partial => '/contacts/
> > > ajaxshoweditcontact'
> > > end %>
> >
> > > and the edit page also has this for the cancel:
> >
> > > _ajaxshoweditcontact.rhtml.
> > > <%= button_to_function 'Cancel' do |page|
> > >   page[:showcontact].replace_html :partial => '/contacts/
> > > ajaxshowcontact'
> > > end %>
> >
> > > When I am trying to display the contact this:
> > > _ajaxshowcontact.rhtml.
> > > <%# = link_to_function 'Edit Contact' do |page|
> > >   page[:showcontact].replace_html :partial => '/contacts/
> > > ajaxshoweditcontact'
> > > end %>
> >
> > > is one of 2 options.
> > > Rails is saying that it cannot allocate memory for this and it will
> > > not even display the initial page that has the 'edit' link.  Is it
> > > trying to render all of the partials before the button or link is even
> > > clicked?
> >
> > > I am trying to cut down on the ajax calls that are not neccesary.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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_function or button_to_function memory usage

2009-12-07 Thread Frederick Cheung


On Dec 7, 4:28 pm, Me  wrote:
> ok maybe not enough detail.
>
> When a user selects a person from a drop down selection  it shows the
> user below with 2 options, to edit the user or delete the user
>
> <%= link_to_function 'Edit Contact' do |page|
>    page[:showcontact].replace_html :partial => '/contacts/
> ajaxshoweditcontact'
>  end %>
>
> Inside the ajaxshoweditcontact there is this link top cancel the edit:
>
> <%= button_to_function 'Cancel' do |page|
>   page[:showcontact].replace_html :partial => '/contacts/
> ajaxshowcontact'
> end %>
>
> Is it generating the partials for both links when I go to the show
> page above?
>

yes - it is generating the partials and including them in the page -
if you look at the source of the page you'd see something like

Element.update('showcontact', 'long html string here')

Fred

> On Dec 6, 5:46 pm, Me  wrote:
>
>
>
> > I have an full ajax app doing crud operations for contact info for one
> > section.  I was using ajax calls to edit and cancel and also to add a
> > contact.  I am implementing a button_to_function instead of doing an
> > ajax call to just edit/add/or cancel a contact.  I am running into a
> > memory issue using the button_to_function or link_to_function.
>
> > I have this:
>
> > <%= link_to_function 'Edit Contact' do |page|
> >   page[:showcontact].replace_html :partial => '/contacts/
> > ajaxshoweditcontact'
> > end %>
>
> > and the edit page also has this for the cancel:
>
> > _ajaxshoweditcontact.rhtml.
> > <%= button_to_function 'Cancel' do |page|
> >   page[:showcontact].replace_html :partial => '/contacts/
> > ajaxshowcontact'
> > end %>
>
> > When I am trying to display the contact this:
> > _ajaxshowcontact.rhtml.
> > <%# = link_to_function 'Edit Contact' do |page|
> >   page[:showcontact].replace_html :partial => '/contacts/
> > ajaxshoweditcontact'
> > end %>
>
> > is one of 2 options.
> > Rails is saying that it cannot allocate memory for this and it will
> > not even display the initial page that has the 'edit' link.  Is it
> > trying to render all of the partials before the button or link is even
> > clicked?
>
> > I am trying to cut down on the ajax calls that are not neccesary.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] problem starting rails (hobo) app with passenger

2009-12-07 Thread Norm Scherer




Edward Samokhvalov wrote:

  ...
Application root:
/home/es-server/employee_status
  

The application root is supposed to be the 'public' directory of app. 
I would assume it should be /home/es-server/employee_status/public





--

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

To post to this group, send email to rubyonrails-t...@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_function or button_to_function memory usage

2009-12-07 Thread Me
ok maybe not enough detail.

When a user selects a person from a drop down selection  it shows the
user below with 2 options, to edit the user or delete the user

<%= link_to_function 'Edit Contact' do |page|
   page[:showcontact].replace_html :partial => '/contacts/
ajaxshoweditcontact'
 end %>

Inside the ajaxshoweditcontact there is this link top cancel the edit:

<%= button_to_function 'Cancel' do |page|
  page[:showcontact].replace_html :partial => '/contacts/
ajaxshowcontact'
end %>

Is it generating the partials for both links when I go to the show
page above?


On Dec 6, 5:46 pm, Me  wrote:
> I have an full ajax app doing crud operations for contact info for one
> section.  I was using ajax calls to edit and cancel and also to add a
> contact.  I am implementing a button_to_function instead of doing an
> ajax call to just edit/add/or cancel a contact.  I am running into a
> memory issue using the button_to_function or link_to_function.
>
> I have this:
>
> <%= link_to_function 'Edit Contact' do |page|
>   page[:showcontact].replace_html :partial => '/contacts/
> ajaxshoweditcontact'
> end %>
>
> and the edit page also has this for the cancel:
>
> _ajaxshoweditcontact.rhtml.
> <%= button_to_function 'Cancel' do |page|
>   page[:showcontact].replace_html :partial => '/contacts/
> ajaxshowcontact'
> end %>
>
> When I am trying to display the contact this:
> _ajaxshowcontact.rhtml.
> <%# = link_to_function 'Edit Contact' do |page|
>   page[:showcontact].replace_html :partial => '/contacts/
> ajaxshoweditcontact'
> end %>
>
> is one of 2 options.
> Rails is saying that it cannot allocate memory for this and it will
> not even display the initial page that has the 'edit' link.  Is it
> trying to render all of the partials before the button or link is even
> clicked?
>
> I am trying to cut down on the ajax calls that are not neccesary.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: setting response.headers is non-effective?

2009-12-07 Thread Frederick Cheung


On Dec 7, 2:52 pm, Rick  wrote:
> Both Ruby and C use the == operator to test that the rvalue equals the
> lvalue, as in:  this_email_message == pedantic
>
> Ruby uses both = and => as assignment operators, depending on the
> situation.  Of course this prompts the student to ask, are two
> assignment operators enough?
>
or how many equality operators are enough ( ==, .eql?, .equal?, ===
(sort of))

Fred

> On Dec 7, 3:48 am, Dave English  wrote:
>
>
>
> > In message
> > ,
> > CoolAJ86  writes
>
> > >As far as I know, this should append these headers to the response
> > >from Rails no matter what, right?
>
> > >I've checked in Fierbug in Fierfox 3.5.5 and I only see my usual
> > >headers. What might be getting in the way?
>
> > Because this is Ruby, not C?
>
> > Use = for assignment, not ==
>
> > Surely?
>
> > >#app/controllers/application_controller.rb
> > >class ApplicationController < ActionController::Base
> > >    after_filter :cors
>
> > >    def cors
> > >      response.headers['Access-Control-Allow-Origin'] == '*'
> > >      response.headers['Access-Control-Allow-Methods'] == 'POST, GET,
> > >PUT, DELETE, OPTIONS, HEAD'
> > >      response.headers['Access-Control-Allow-Credentials'] == 'true'
> > >      response.headers['Access-Control-Allow-Headers'] == 'X-
> > >PINGOTHER'
> > >      response.headers['Access-Control-Max-Age'] == '86400' # 24 hours
> > >    end
> > >end
>
> > --
> > Dave English - Principal Software QA Engineer
> > Fiscal Systems (Software) Ltd

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Downloading Ruby on Rails guides for offline use?

2009-12-07 Thread Frederick Cheung


On Dec 7, 3:21 pm, T_P  wrote:
> Hi!
>
> The guides onhttp://guides.rubyonrails.org/are masterpieces. Is
> there a convenient way to download all of them for off-line use?
>

You should be able to generate them yourself - run rake doc:guides
from a rails app (it should put the output in doc/guides) or clone the
rails source and run the doc task from there (if you want the most up
to date ones)

Fred


> Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Downloading Ruby on Rails guides for offline use?

2009-12-07 Thread T_P
Hi!

The guides on http://guides.rubyonrails.org/ are masterpieces. Is
there a convenient way to download all of them for off-line use?

Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread T_P
Oh yes, it possible to use Postgresql with the BitNami package. But
the downside is that you still end up having MySQL around. :-/
First you install the BitNami Rubystack with MySQL, then you use
Postgresql add-on.

Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: setting response.headers is non-effective?

2009-12-07 Thread Rick
Both Ruby and C use the == operator to test that the rvalue equals the
lvalue, as in:  this_email_message == pedantic

Ruby uses both = and => as assignment operators, depending on the
situation.  Of course this prompts the student to ask, are two
assignment operators enough?

On Dec 7, 3:48 am, Dave English  wrote:
> In message
> ,
> CoolAJ86  writes
>
> >As far as I know, this should append these headers to the response
> >from Rails no matter what, right?
>
> >I've checked in Fierbug in Fierfox 3.5.5 and I only see my usual
> >headers. What might be getting in the way?
>
> Because this is Ruby, not C?
>
> Use = for assignment, not ==
>
> Surely?
>
> >#app/controllers/application_controller.rb
> >class ApplicationController < ActionController::Base
> >    after_filter :cors
>
> >    def cors
> >      response.headers['Access-Control-Allow-Origin'] == '*'
> >      response.headers['Access-Control-Allow-Methods'] == 'POST, GET,
> >PUT, DELETE, OPTIONS, HEAD'
> >      response.headers['Access-Control-Allow-Credentials'] == 'true'
> >      response.headers['Access-Control-Allow-Headers'] == 'X-
> >PINGOTHER'
> >      response.headers['Access-Control-Max-Age'] == '86400' # 24 hours
> >    end
> >end
>
> --
> Dave English - Principal Software QA Engineer
> Fiscal Systems (Software) Ltd

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] view to pdf with pdf::writer

2009-12-07 Thread isabel
Hello,

I would like to send a view to a pdf file.
To do that I have choosen the tool "pdf::writer", I have tested it and
I found a problem when I do:

 pdf.text render :layout => "my_layout"

it sends the whole html code to the pdf file.

How could I send the result of the html file to the pdf file?

Thanks and let me know if you do not understand it.

Isabel

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Business logic against model records

2009-12-07 Thread Andrew Edwards
I had be contemplating a STI solution but it still involved account
types in the database.

I can see a number of problems being solved with your suggestion,
hadn't thought of it this way. My initial thought though is that
potentially there are around 10-15 account types, would this start to
look ugly with so many models extending this single feature?

I've also got to check how STI influences AR performance. Potentially
I've got around a million records in the accounts table as each
product will have multiple accounts based on batches. Each time a
delivery arrives it creates a new batch for that product which in turn
creates a new account(s).

Every product has around 10 accounts, and every product creates a new
set when a new batch of stock arrives, approx. 24 times a year. So you
can see each product may spawn around 240 accounts a year at worst
case scenario. It's a little heavy but storage is cheap and it allows
a fantastic level of visibility of inventory progress and history.
Just got to watch performance. Indexes and caching will likely be
first ports of call.

Once an account reaches zero it is essentially dead and no longer
used, however I need to keep it on hand for audit trail purposes. I
will likely implement an accounting period function which archives
older accounts out of the live accounts table.

On 7 Dec, 14:07, Clemens  wrote:
> possibly a case for Single Table Inheritance(STI)?
>
> class InventoryAccount < AR::Base
>   belongs_to :product
>   belongs_to :storage_location
>   has_many :inventory_account_entries
>
>   # common inventory account behaviour, possibly making use of
>   # template method pattern
> end
>
> class AvailableInvetoryAccount < InventoryAccount
>   # specific code/behaviour for Available...
> end
>
> class ReservedInvetoryAccount < InventoryAccount
>   # specific code/behaviour for Reserved...
> end
> ...
>
> On 7 Dez., 14:49, Andrew Edwards 
> wrote:
>
>
>
> > Hi,
>
> > I have a small architectural decision to make.
>
> > I'm modeling double entry accounts to handle product inventory. An
> > account is a combination of a product, storage location. Accounts also
> > have sub-types such as "Available" and "Reserved".
>
> > Therefore it is possible to have more than one account for the
> > combination of ProductA and LocationA, one account with type
> > "Available" and another with type "Reserved". Accounts contain entries
> > which add or subtract against the account balance. Entries then belong
> > to transactions which ensure every addition to one account has a
> > subtraction from another, essentially that product inventory is
> > preserved.
>
> > class InventoryAccount < AR::Base
> >    belongs_to :inventory_account_type
> >    belongs_to :product
> >    belongs_to :storage_location
> >    has_many :inventory_account_entries
> > end
>
> > My issue is with InventoryAccountType, currently this is a AR model
> > and a simple database table holding around 10 rows with a column for
> > the type name (Available, Reserved etc). I populate this as seed data
> > at application setup.
>
> > InventoryAccountTypes don't necessarily need to be in the database
> > although each account will need to be identified as one or the other
> > some how (currently via foreign key to the types table). They are also
> > fairly static and may only change with application feature updates.
>
> > I now need to define posting rules which are basically business logic
> > for whenever a particular entry is made to an account of a certain
> > type. Each account type has it's own set of posting rules.
>
> > I have considered creating an AR model for the posting rules and
> > associating them with the account type. However I'm not sure about
> > leverage the database layer to hold so much hardcoded business logic
> > and relationships?
>
> > I also don't like relying on seed data to put business logic
> > relationships in place.
>
> > I feel like I should place the business logic and available account
> > types firmly in ruby code. What do people think? Has anyone tackled
> > anything similar?
>
> > Thanks, Andrew.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Ann: ArEvents

2009-12-07 Thread Raphael Bauduin
Just added the possibility to ignore events permanently:

ArEventComment.ignore_ar_events(:before_create)
#some code
ArEventComment.ignore_ar_events(:before_create)

or with a block of code:

ArEventComment.ignore_ar_events(:before_create) do
#some code
end

The code is on github: http://github.com/raphinou/ArEvents

Raph


On Thu, Dec 3, 2009 at 5:19 PM, Raphael Bauduin  wrote:
> Hi,
>
> I needed to be able to add actions to be taken during the lifecycle of
> ActiveRecord object, but needed to configure it dynamically.
> Observers were not flexible enough and I ended up developing ArEvents,
> which lets you easily attach and detach event listeners, the events
> correspond to the active record callbacks.
>
> If you have an existing model, just include the ArEvents module:
>
> ArEventComment.send(:include, ArEvents)
>
> and you can then add event listeners:
>
> ArEventComment.add_ar_event_listener(:before_validation, 
> ArEventCommentListener)
>
> An event listener is simply a class with a class method named trigger
> that takes 2 arguments: the event fired and the object fireing the
> event:
>
>  class ArEventCommentListener
>def self.trigger(evt, obj)
>  puts "event #{evt} triggered by object #{obj.inspect}"
>end
>  end
>
>
> I'm not yet using it in production, but tests pass as expected.
>
> You can find the code at http://github.com/raphinou/ArEvents
>
> All comments and suggestions are of course welcome!
>
> Raphaël
>
>
> --
> Web database: http://www.myowndb.com
> Free Software Developers Meeting: http://www.fosdem.org
>



-- 
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Business logic against model records

2009-12-07 Thread Clemens
possibly a case for Single Table Inheritance(STI)?

class InventoryAccount < AR::Base
  belongs_to :product
  belongs_to :storage_location
  has_many :inventory_account_entries

  # common inventory account behaviour, possibly making use of
  # template method pattern
end

class AvailableInvetoryAccount < InventoryAccount
  # specific code/behaviour for Available...
end

class ReservedInvetoryAccount < InventoryAccount
  # specific code/behaviour for Reserved...
end
...



On 7 Dez., 14:49, Andrew Edwards 
wrote:
> Hi,
>
> I have a small architectural decision to make.
>
> I'm modeling double entry accounts to handle product inventory. An
> account is a combination of a product, storage location. Accounts also
> have sub-types such as "Available" and "Reserved".
>
> Therefore it is possible to have more than one account for the
> combination of ProductA and LocationA, one account with type
> "Available" and another with type "Reserved". Accounts contain entries
> which add or subtract against the account balance. Entries then belong
> to transactions which ensure every addition to one account has a
> subtraction from another, essentially that product inventory is
> preserved.
>
> class InventoryAccount < AR::Base
>    belongs_to :inventory_account_type
>    belongs_to :product
>    belongs_to :storage_location
>    has_many :inventory_account_entries
> end
>
> My issue is with InventoryAccountType, currently this is a AR model
> and a simple database table holding around 10 rows with a column for
> the type name (Available, Reserved etc). I populate this as seed data
> at application setup.
>
> InventoryAccountTypes don't necessarily need to be in the database
> although each account will need to be identified as one or the other
> some how (currently via foreign key to the types table). They are also
> fairly static and may only change with application feature updates.
>
> I now need to define posting rules which are basically business logic
> for whenever a particular entry is made to an account of a certain
> type. Each account type has it's own set of posting rules.
>
> I have considered creating an AR model for the posting rules and
> associating them with the account type. However I'm not sure about
> leverage the database layer to hold so much hardcoded business logic
> and relationships?
>
> I also don't like relying on seed data to put business logic
> relationships in place.
>
> I feel like I should place the business logic and available account
> types firmly in ruby code. What do people think? Has anyone tackled
> anything similar?
>
> Thanks, Andrew.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Business logic against model records

2009-12-07 Thread Andrew Edwards
Hi,

I have a small architectural decision to make.

I'm modeling double entry accounts to handle product inventory. An
account is a combination of a product, storage location. Accounts also
have sub-types such as "Available" and "Reserved".

Therefore it is possible to have more than one account for the
combination of ProductA and LocationA, one account with type
"Available" and another with type "Reserved". Accounts contain entries
which add or subtract against the account balance. Entries then belong
to transactions which ensure every addition to one account has a
subtraction from another, essentially that product inventory is
preserved.

class InventoryAccount < AR::Base
   belongs_to :inventory_account_type
   belongs_to :product
   belongs_to :storage_location
   has_many :inventory_account_entries
end

My issue is with InventoryAccountType, currently this is a AR model
and a simple database table holding around 10 rows with a column for
the type name (Available, Reserved etc). I populate this as seed data
at application setup.

InventoryAccountTypes don't necessarily need to be in the database
although each account will need to be identified as one or the other
some how (currently via foreign key to the types table). They are also
fairly static and may only change with application feature updates.

I now need to define posting rules which are basically business logic
for whenever a particular entry is made to an account of a certain
type. Each account type has it's own set of posting rules.

I have considered creating an AR model for the posting rules and
associating them with the account type. However I'm not sure about
leverage the database layer to hold so much hardcoded business logic
and relationships?

I also don't like relying on seed data to put business logic
relationships in place.

I feel like I should place the business logic and available account
types firmly in ruby code. What do people think? Has anyone tackled
anything similar?

Thanks, Andrew.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04 - SOLVED.

2009-12-07 Thread LuisRuby
Hi friends!
My problem has gone!
With a little shame because it's so easy... :-).
I received a tip to put "PATH=/var/lib/gems/1.8/bin:$PATH" in my
file .profile with gedit. And all goes well!
Thank you to everybody!

On Dec 7, 10:11 am, LuisRuby  wrote:
> H, thank you. But I saw that BitNami install Mysql and PHP. Well,
> I thought to use Firebird but it is more probable that I will use
> Postgre and RoR. Is it possible?
>
> On Dec 7, 7:34 am, T_P  wrote:
>
> > Hi, Luiz!
>
> > I had the same problem as you. Namely, I struggled with installing RoR
> > development environment on my Ubuntu box.
> > I found a nice and EASY solution: use BitNami RubyStack, which is
> > available athttp://bitnami.org/stack/rubystack. Everything
> > is included, and it works out of the box. I highly recommend it.
>
> > It has a very clear user guide as well, 
> > athttp://bitnami.org/files/stacks/rubystack/2.0-0/rubystack.pdf.
>
> > Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: accepts_nested_attributes_for + paperclip + polymorphic + problem

2009-12-07 Thread Antony Sastre

Hi Ab,

The form view should read:

<% form_for @office, :html => {:multipart => true} do |f| %>

This is always the case when dealing with file uploads.


On Dec 7, 9:05 am, Abhishek shukla  wrote:
> Hello Friends,
>
> I am not able to retrieve the value form page
>
> controller
>   offices_controller
>     def new
>     �...@office = Office.new
>     end
>
>     def create
>     �...@office = Office.new(params[:office])
>     �...@office.save
>    end
>  end
>
> VIEW
>   <% form_for @office do |f| %>
>     <%= f.text_area :office_name %>
>     <% f.fields_for :images_attributes do |i| %>
>      <%= i.file_field :avatar %>
>     <%end%>
>     <%= f.submit "Submit" %>
>   <%end%>
>
> Model
>
> Office.rb
>     accepts_nested_attributes_for :image
>
> Image.rb
>      belongs_to :imagable, :polymorphic => true
>
> PROBLEM
>  When I press submit, the params[:office] only contain :office_name and
> avatar is getting lost? I don;t know where excatly I am getting wrong.
>
> Thanks for any suggestion
>
> Abhis

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Secure receipt generation

2009-12-07 Thread Niels Meersschaert
Why not just scope the find to the user?

class User
has_many :receipts
end

Then in your controller you can do something like

def show
file_ref = current_user.receipts.find(params[:id])

#Read file code
end


On Dec 7, 2009, at 7:43 AM, icke wrote:

> Has anyone got any ideas on how to approach the following:
> 
> I generate a pdf receipt and store it in a directory "outside" of
> public since I do not want users to be able to just mess about with
> URLs and look at other users receipts.  However, I do want users to be
> able to download and see their own receipt.  I am struggling to come
> up with a way of the browser showing the pdf but denying access to
> other pdf's.
> 
> I had thought of using some sort of md5 generated id on a resource
> called "receipt" to do a show but in the end there is always some
> URL.  Is there a way of creating some sort of "one-time-use" URL by
> forming the headers accordingly and then simply using a file-read to
> serve up the file.  To me this seems a bit weird as the whole point of
> webservers is doing precisely this.
> 
> I must be thinking along the wrong lines.
> 
> Thanks.
> 
> O.
> 
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
> 
> 

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Secure receipt generation

2009-12-07 Thread icke
Has anyone got any ideas on how to approach the following:

I generate a pdf receipt and store it in a directory "outside" of
public since I do not want users to be able to just mess about with
URLs and look at other users receipts.  However, I do want users to be
able to download and see their own receipt.  I am struggling to come
up with a way of the browser showing the pdf but denying access to
other pdf's.

I had thought of using some sort of md5 generated id on a resource
called "receipt" to do a show but in the end there is always some
URL.  Is there a way of creating some sort of "one-time-use" URL by
forming the headers accordingly and then simply using a file-read to
serve up the file.  To me this seems a bit weird as the whole point of
webservers is doing precisely this.

I must be thinking along the wrong lines.

Thanks.

O.


--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: hiding specific links

2009-12-07 Thread Colin Law
2009/12/6 RubyonRails_newbie :
> ** Resolved... **
>
> If anyone else comes across a similar issue, I did this to hide the
> delete link if no posts exist:
>
>        <% if Post.exists?(@posts) %>
>
>
>        <%= image_tag ("delete.png") %>
>
>                <%= link_to "Delete post",
>                        { :controller => "posts", :action => "delete",
>                          :id => @posts },
>                          :confirm => "Really delete this post? You cannot 
> undo this!" %>
>


Could you not just test @posts directly, presumably it will be nil or
empty or something, or am I missing something?  I am a bit confused as
I would expect a variable called @posts to be an array of Post objects
but since you are using :id => posts that suggests it is just one.

Colin

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread LuisRuby
H, thank you. But I saw that BitNami install Mysql and PHP. Well,
I thought to use Firebird but it is more probable that I will use
Postgre and RoR. Is it possible?


On Dec 7, 7:34 am, T_P  wrote:
> Hi, Luiz!
>
> I had the same problem as you. Namely, I struggled with installing RoR
> development environment on my Ubuntu box.
> I found a nice and EASY solution: use BitNami RubyStack, which is
> available athttp://bitnami.org/stack/rubystack. Everything
> is included, and it works out of the box. I highly recommend it.
>
> It has a very clear user guide as well, 
> athttp://bitnami.org/files/stacks/rubystack/2.0-0/rubystack.pdf.
>
>
>
> Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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: Cucumber and general Ruby question

2009-12-07 Thread Clemens
you could use tables

feature:
...
   Given the site has the following pages
|page title|
| title 1 |
| title 2 |
| title 3 |


...steps.rb:
...
Given /^the site has the following pages$/ do | pages |
pages.each |page_title|
  Page.create :title => page_title unless Page.find_by_title
(page_title)
end
end
...


On 7 Dez., 10:52, Gintautas Šimkus  wrote:
> Hello,
>
> I have this cucumber step definition:
>
> Given /^the site has pages "(.+)" and "(.+)"$/ do | page_1, page_2 |
>     Page.create :title => page_1 if Page.find_by_title(page_1).nil?
>     Page.create :title => page_2 if Page.find_by_title(page_2).nil?
> end
>
> This works, but obviously I would like to DRY it up. I was thinking along
> the lines.
>
> Given /^the site has pages "(.+)" and "(.+)"$/ do | *args |
>     args.each { |page| Page.create :title => page if
> Page.find_by_title(page).nil? }
> end
>
> The code is not syntactically correct that is what my question is about: how
> to implement this concept right?
>
> 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-t...@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 do so many Ruby/Rails developers use Macs?

2009-12-07 Thread aldo.nievas
I bought a Macbook Pro from Argentina by u$2200 through
megadistributors.com
Just only u$300 more than US. And they delivered it at your door home.

And why Mac for Rail development ? Did you use combination Mac +
Texmate ? It's awesome.

DHH and his team were developed Rails using that combination.

Cheers.
Aldo Nievas
www.satio.com.ar
aldo.nievas (skype)


On Dec 4, 10:16 pm, Agustin Nicolas Viñao Laseras
 wrote:
> I talked Mac in Argentina (reseller, not direct Mac Store) is expensive to
> buy the equipment. Whoever knows the benefits of using Mac hardware knows it
> is not the same team using a different brand with OSX.
> The price of Macbook Pro 2.66 in Argentina is $ S 3300 and in U.S. u $ s
> 1999. And the reason is not taxes, is by middlemen.
>
> Spanish mac 
> reseller:http://www.macstore.com.ar/producto.php?id=1615&idCategoria=1&idSubca...
> (1 u$S = $3.82 argentine pesos)
>
> Mac U.S. web:http://store.apple.com/us/browse/home/shop_mac/family/macbook_pro
> ___
>         Agustin Viñaowww.agustinvinao.com.ar
>    agustinvinao (Skype)
>
> On Fri, Dec 4, 2009 at 6:32 PM, Colin Law  wrote:
> > 2009/12/4 Agustin Nicolas Viñao Laseras :
> > > So sad that Mac not in countries like Argentina, only have expensive
> > > resellers, we must pay price of 150% or more compared with the U.S..
> > > ___
>
> > Then you could use Ubuntu or one of the other similar distributions.
> > That is good for RoR and cheaper, with excellent community support.
>
> > Colin
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@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.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Route error to Admin namespace

2009-12-07 Thread Kristian Hellquist
2009/12/6 Paulo Coutinho :
> Hi.
>
> Your solution dont solve.
>
> But i try it:
>
> map.with_options(:namespace => "admin") do |admin|
>   admin.clients_index 'admin/clients', :controller => 'clients' #im on
> admin so dont need redirect to "admin/clients" only "clients"
> end
>
> And to the index(home) action, it is OK, but for the others actions, NO
> (insert/delete/edit).
>
> This solution is near, but have to put all action do controller "clients".
>
> Any ideia?

Oh my mistake ... :)

map.with_options(:namespace => "admin") do |admin|
  admin.clients_index 'clients', :controller => 'clients', :action => 'index'
  admin.clients_edit 'clients/:id/edit', :controller => 'clients',
:action => 'edit'
  admin.clients_insert 'clients/insert', :controller => 'clients',
:action => 'insert',  :conditions => { :method => :post }
end

Hint: Your actions looks to match the resource-pattern


>
>
> --
> Atenciosamente,
> Paulo Coutinho.
> Blog: www.prsolucoes.com/blog
> Site: www.prsolucoes.com
> Msn:  pa...@prsolucoes.com
>
>
> 2009/12/6 Kristian Hellquist 
>>
>> > But local and on my server(passenger) it is ok, and function normal, but
>> > on
>> > JRUBY i get an error because it is thinking that "admin" is a controller
>> > and
>> > "clients" is a action of "admin".
>> >
>> > My controllers is not restfull, so what i have to do, to correct it? Or
>> > what
>> > the best method to make the "admin"? I have to put any route?
>>
>> I have an admin section in jruby application. Try to set the routes
>> explicit with an admin namespace.
>>
>> map.with_options(:namespace => "admin") do |admin|
>>  admin.resources :clients
>>  # or in non restful-pattern
>>  admin.clients_index 'clients', :controller => 'admin/clients',
>> :action => 'index'
>> 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-t...@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.
>>
>>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread T_P
Hi, Luiz!

I had the same problem as you. Namely, I struggled with installing RoR
development environment on my Ubuntu box.
I found a nice and EASY solution: use BitNami RubyStack, which is
available at http://bitnami.org/stack/rubystack. Everything
is included, and it works out of the box. I highly recommend it.

It has a very clear user guide as well, at
http://bitnami.org/files/stacks/rubystack/2.0-0/rubystack.pdf.

HTH.

Tuo

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Where do I set Custom Headers as default?

2009-12-07 Thread Peter De Berdt

On 07 Dec 2009, at 03:45, CoolAJ86 wrote:

> I would like to change the default headers which are sent out to
> include these CORS headers:
>
> Access-Control-Allow-Origin: *
> Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
> Access-Control-Allow-Headers: X-PINGOTHER
> Content-Type: application/json; charset=UTF-8
>
> Could someone tell me where it is that I specify this?

Assuming that you are on Rails 2.3 or higher, I would use a rack  
middleware for that. You have an example at 
http://www.hokstad.com/rewriting-content-types-with-rack.html

Keep in mind that the Rack config file in Rails is replaced by adding  
the rack middleware to environment.rb instead with:

config.middleware.use NameOfMiddleWareClass


Best regards

Peter De Berdt

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Cucumber and general Ruby question

2009-12-07 Thread Gintautas Šimkus
Hello,

I have this cucumber step definition:

Given /^the site has pages "(.+)" and "(.+)"$/ do | page_1, page_2 |
Page.create :title => page_1 if Page.find_by_title(page_1).nil?
Page.create :title => page_2 if Page.find_by_title(page_2).nil?
end

This works, but obviously I would like to DRY it up. I was thinking along
the lines.

Given /^the site has pages "(.+)" and "(.+)"$/ do | *args |
args.each { |page| Page.create :title => page if
Page.find_by_title(page).nil? }
end

The code is not syntactically correct that is what my question is about: how
to implement this concept right?

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-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread LuisRuby
OK, this is the result:
gem env
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- GEMS PATHS:
   - /var/lib/gems/1.8
   - /home/luiz/.gem/ruby/1.8

On Dec 7, 7:22 am, rtacconi  wrote:
> Usually when you export the path it should work. Check again that the
> path corresponds to the gems path where you have the Rails gem. You
> can use this command:
>
> gem env
>
> to gather more info about the gem environment and you should be able
> to see the GEM_PATH, so check if in that path you have the Rails gem.
> It is a boring problem but it is usually a path issue.
>
> Have you installed another version of Ruby? Reply with you gem env
> output to get more help.
>
> On Dec 6, 4:04 pm, LuisRuby  wrote:
>
> > Dear friends,
> > I installed RoR using the "Agile Web Development with Rails, 3rd
> > edition" recipe in my Ubuntu 9.04. Apparently all has been installed
> > well, but when I try to create a new application (page 35) using the
> > command "rails demo", I get the message "The program 'rails' is
> > currently not installed. You can install it by typing: sudo apt-get
> > install rails.  bash: rails: command not found."
> > It seems that Ubuntu not find Rails... and I typed the command "export
> > PATH=/var/lib/gems/1.8/bin:$PATH.
> > Sorry, I am RoR and Ubuntu novice.
> > Thank you in advance!!
>
> > Luiz

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] Ubuntu + RoR + Firebird OR Ubuntu + RoR + PostgreSQL ?

2009-12-07 Thread LuisRuby
Dear friends,
I am starting to build a system for an university using RoR. I would
like to use Firebird because I worked with it for a long time and I
love it! In this new project I will use a lot of stored procedures,
data referential integrity and so on. But when I looked for the
Firebird adapter for Ruby and the activerecord for Firebird adapter,
it seems to have so few support and so few users, that I am afraid
about its future.
This is one of the most important e-mails I've sent on my life! If
I have to start using Postgre the time is now. But with a great pain
on my heart for the Firebird.
Could someone give me a good advice?
Thank you very much!

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread rtacconi
Usually when you export the path it should work. Check again that the
path corresponds to the gems path where you have the Rails gem. You
can use this command:

gem env

to gather more info about the gem environment and you should be able
to see the GEM_PATH, so check if in that path you have the Rails gem.
It is a boring problem but it is usually a path issue.

Have you installed another version of Ruby? Reply with you gem env
output to get more help.

On Dec 6, 4:04 pm, LuisRuby  wrote:
> Dear friends,
> I installed RoR using the "Agile Web Development with Rails, 3rd
> edition" recipe in my Ubuntu 9.04. Apparently all has been installed
> well, but when I try to create a new application (page 35) using the
> command "rails demo", I get the message "The program 'rails' is
> currently not installed. You can install it by typing: sudo apt-get
> install rails.  bash: rails: command not found."
> It seems that Ubuntu not find Rails... and I typed the command "export
> PATH=/var/lib/gems/1.8/bin:$PATH.
> Sorry, I am RoR and Ubuntu novice.
> Thank you in advance!!
>
> Luiz

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] Re: Starting server is failing on Mac OSX 10.6 Snow Leopard

2009-12-07 Thread Conrad Taylor
On Sun, Dec 6, 2009 at 6:28 PM, timr  wrote:

> I need help getting hpricot running on mac OS 10.6.2, ruby 1.9.1.
> Others have had the same problem apparently no answer has been posted.
> It seems that the gem install is not compiling one of the bundle files
> with the correct architecture. I am asking again for any help.
> Thanks in advance,
> Tim
>
> Here is how install goes:
>
> Tim:~/Desktop/RubyClub> sudo env ARCHFLAGS="-arch i386" gem install
> why-hpricot --source http://gems.github.com
> Building native extensions.  This could take a while...
> Successfully installed why-hpricot-0.7.229
> 1 gem installed
> Installing ri documentation for why-hpricot-0.7.229...
> Installing RDoc documentation for why-hpricot-0.7.229...
> Tim:~/Desktop/RubyClub> gem which hpricot
> (checking gem why-hpricot-0.7.229 for hpricot)
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb
> Tim:~/Desktop/RubyClub> ruby -e 'require "hpricot"'
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `require': dlopen(/usr/local/lib/ruby19/gems/1.9.1/
> gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle, 9): no suitable
> image found.  Did find: (LoadError)
> /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot_scan.bundle: mach-o, but wrong architecture - /usr/local/lib/
> ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/hpricot_scan.bundle
>from /usr/local/lib/ruby19/gems/1.9.1/gems/why-hpricot-0.7.229/lib/
> hpricot.rb:20:in `'
>from -e:1:in `require'
>from -e:1:in `'
>
>
Tim, the most recent version of hpricot is 0.8.2.  Thus, if you're
reinstalling
things, you might want to begin by making gemcutter.org your primary gem
repository by doing the following:

sudo gem install gemcutter
gem tumble
sudo gem install hpricot

Next, let's poke around your environment a bit by executing the following
commands:

which gem
gem environment
which ruby

Please give that a try and report back.

Good luck,

-Conrad


> On Oct 30, 9:01 am, Kurt  wrote:
> > I am still running into this issue even after reinstalling hpricot
> > under Snow Leopard. When I require 'hpricot' I get this error:
> >
> > /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.8.1/lib/
> > hpricot_scan.bundle: mach-o, but wrong architecture - /usr/local/lib/
> > ruby/gems/1.8/gems/hpricot-0.8.1/lib/hpricot_scan.bundle
> >
> > I have uninstalled and reinstalled the gem, including forcing the
> > architecture (both 64 and 32 bit). Either way I get the same error.
> > Here is what I've tried:
> >
> > sudo gem install hpricot
> > sudo env ARCHFLAGS='-arch x86_64' gem install hpricot
> > sudo env ARCHFLAGS='i386' gem install hpricot
> >
> > I am using Ruby 1.8.7 on a Mac Pro running 10.6.1.
> >
> > On Sep 5, 1:13 am, Ryo  wrote:
> >
> >
> >
> > > This issue has been resolved by reinstalling all gems.
> >
> > >http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] problem starting rails (hobo) app with passenger

2009-12-07 Thread Edward Samokhvalov
Dear All!

I've set up my apache, passenger and configs, the passenger works, but
the app can't be started. the erros are the following

These are the possible causes:

*
  There may be a syntax error in the application's code. Please
check for such errors and fix them.
*
  A required library may not installed. Please install all
libraries that this application requires.
*
  The application may not be properly configured. Please check
whether all configuration files are written correctly, fix any
incorrect configurations, and restart this application.
*
  A service that the application relies on (such as the database
server or the Ferret search engine server) may not have been started.
Please start that service.

Further information about the error may have been written to the
application's log file. Please check it in order to analyse the
problem.

Error message:
No such file or directory - /nonexistent
Exception class:
Errno::ENOENT
Application root:
/home/es-server/employee_status

Backtrace:
#   FileLineLocation
0   /usr/local/lib/site_ruby/1.8/rubygems.rb723 in
`initialize'
1   /usr/local/lib/site_ruby/1.8/rubygems.rb723 in
`new'
2   /usr/local/lib/site_ruby/1.8/rubygems.rb723 in
`set_paths'
3   /usr/local/lib/site_ruby/1.8/rubygems.rb719 in
`each'
4   /usr/local/lib/site_ruby/1.8/rubygems.rb719 in
`set_paths'
5   /usr/local/lib/site_ruby/1.8/rubygems.rb526 in
`path'
6   /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb
66  in
`installed_spec_directories'
7   /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb
56  in
`from_installed_gems'
8   /usr/local/lib/site_ruby/1.8/rubygems.rb736 in
`source_index'
9   /usr/local/lib/site_ruby/1.8/rubygems.rb140 in
`activate'
10  /usr/local/lib/site_ruby/1.8/rubygems.rb49  in
`gem'
11  /home/es-server/employee_status/config/boot.rb  60  in
`load_rails_gem'
12  /home/es-server/employee_status/config/boot.rb  54  in
`load_initializer'
13  /home/es-server/employee_status/config/boot.rb  38  in
`run'
14  /home/es-server/employee_status/config/boot.rb  11  in
`boot!'
15  /home/es-server/employee_status/config/boot.rb  110
16  /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb 31
in `gem_original_require'
17  /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb 31
in `require'
18  /home/es-server/employee_status/config/environment.rb   7
19  /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb 31
in `gem_original_require'
20  /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb 31
in `require'
21  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/railz/application_spawner.rb  299 in
`preload_application'
22  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/railz/application_spawner.rb  248 in
`initialize_server'
23  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/utils.rb  255 in `report_app_init_status'
24  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/railz/application_spawner.rb  233 in
`initialize_server'
25  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server.rb194 in
`start_synchronously'
26  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server.rb163 in `start'
27  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/railz/application_spawner.rb  209 in `start'
28  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/spawn_manager.rb  262 in
`spawn_rails_application'
29  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server_collection.rb 126 in
`lookup_or_add'
30  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/spawn_manager.rb  256 in
`spawn_rails_application'
31  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server_collection.rb 80  in
`synchronize'
32  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server_collection.rb 79  in
`synchronize'
33  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/spawn_manager.rb  255 in
`spawn_rails_application'
34  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/spawn_manager.rb  154 in `spawn_application'
35  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/spawn_manager.rb  287 in
`handle_spawn_application'
36  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server.rb352 in `__send__'
37  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/lib/
phusion_passenger/abstract_server.

Re: [Rails] Re: Starting server is failing on Mac OSX 10.6 Snow Leopard

2009-12-07 Thread Conrad Taylor
On Fri, Oct 30, 2009 at 9:01 AM, Kurt  wrote:

>
> I am still running into this issue even after reinstalling hpricot
> under Snow Leopard. When I require 'hpricot' I get this error:
>
>/usr/local/lib/ruby/gems/1.8/gems/hpricot-0.8.1/lib/
> hpricot_scan.bundle: mach-o, but wrong architecture - /usr/local/lib/
> ruby/gems/1.8/gems/hpricot-0.8.1/lib/hpricot_scan.bundle
>
> I have uninstalled and reinstalled the gem, including forcing the
> architecture (both 64 and 32 bit). Either way I get the same error.
> Here is what I've tried:
>
> sudo gem install hpricot
> sudo env ARCHFLAGS='-arch x86_64' gem install hpricot
> sudo env ARCHFLAGS='i386' gem install hpricot
>
> I am using Ruby 1.8.7 on a Mac Pro running 10.6.1.
>
>
Kurt, do you have a test case for reproducing the error message?

-Conrad


> On Sep 5, 1:13 am, Ryo  wrote:
> > This issue has been resolved by reinstalling all gems.
> >
> > http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
>
> --~--~-~--~~~---~--~~
> 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
> -~--~~~~--~~--~--~---
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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 installing RoR Ubuntu 9.04

2009-12-07 Thread LuisRuby
OK but... I forgot to ask... before any try to solve my problem, I
think I have to uninstall RoR and then reinstall. How to do that? I
found something but as I'm a novice, it's difficult to choose a path.
Thank you for all that gently replied!

On Dec 6, 2:35 pm, Dhruva Sagar  wrote:
> Hi,
>
> Follow this tutorial.https://help.ubuntu.com/community/RubyOnRails
>
> Thanks & Regards,
> Dhruva Sagar.
>
> On Sun, Dec 6, 2009 at 9:34 PM, LuisRuby  wrote:
> > Dear friends,
> > I installed RoR using the "Agile Web Development with Rails, 3rd
> > edition" recipe in my Ubuntu 9.04. Apparently all has been installed
> > well, but when I try to create a new application (page 35) using the
> > command "rails demo", I get the message "The program 'rails' is
> > currently not installed. You can install it by typing: sudo apt-get
> > install rails.  bash: rails: command not found."
> > It seems that Ubuntu not find Rails... and I typed the command "export
> > PATH=/var/lib/gems/1.8/bin:$PATH.
> > Sorry, I am RoR and Ubuntu novice.
> > Thank you in advance!!
>
> > Luiz
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@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.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.




Re: [Rails] setting response.headers is non-effective?

2009-12-07 Thread Dave English
In message 
, 
CoolAJ86  writes
>As far as I know, this should append these headers to the response
>from Rails no matter what, right?
>
>I've checked in Fierbug in Fierfox 3.5.5 and I only see my usual
>headers. What might be getting in the way?

Because this is Ruby, not C?

Use = for assignment, not ==

Surely?

>#app/controllers/application_controller.rb
>class ApplicationController < ActionController::Base
>after_filter :cors
>
>def cors
>  response.headers['Access-Control-Allow-Origin'] == '*'
>  response.headers['Access-Control-Allow-Methods'] == 'POST, GET,
>PUT, DELETE, OPTIONS, HEAD'
>  response.headers['Access-Control-Allow-Credentials'] == 'true'
>  response.headers['Access-Control-Allow-Headers'] == 'X-
>PINGOTHER'
>  response.headers['Access-Control-Max-Age'] == '86400' # 24 hours
>end
>end
-- 
Dave English - Principal Software QA Engineer
Fiscal Systems (Software) Ltd

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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] accepts_nested_attributes_for + paperclip + polymorphic + problem

2009-12-07 Thread Abhishek shukla
Hello Friends,


I am not able to retrieve the value form page

controller
  offices_controller
def new
 @office = Office.new
end

def create
 @office = Office.new(params[:office])
 @office.save
   end
 end

VIEW
  <% form_for @office do |f| %>
<%= f.text_area :office_name %>
<% f.fields_for :images_attributes do |i| %>
 <%= i.file_field :avatar %>
<%end%>
<%= f.submit "Submit" %>
  <%end%>

Model

Office.rb
accepts_nested_attributes_for :image

Image.rb
 belongs_to :imagable, :polymorphic => true

PROBLEM
 When I press submit, the params[:office] only contain :office_name and
avatar is getting lost? I don;t know where excatly I am getting wrong.

Thanks for any suggestion

Abhis

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@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.