[Rails] Re: how to configure a server with new development environment

2008-10-15 Thread Sunny Bogawat

Mm Zz wrote:
I created sunny.rb also but from aptana it not showing me that new 
environment
when i am going for adding server
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Fixtures, testing and namespaces

2008-10-15 Thread Chris Stump

fixtures :main_users

That should work with your namespaced models. Then you need to specify 
the fixtures class (do so beneath the above fixtures method call).

set_fixture_class :main_users => Main::User

Fixtures file main_users.yml can go in the test/fixtures directory.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] rspec fails when assigning to an ActiveRecord field

2008-10-15 Thread leo

HI,
I have a controller action that assigns a user_id to an event record.
The app works fine from the browser.  However, rspec fails and I
cannot figure out why.  I have several tests failing but I'll give an
example created by script/generate rspec_controller.
Any help will be appreciated.




RSPEC test
102 describe "with invalid params" do
103
104   it "should expose a newly created but unsaved event as
@event" do
105 Event.stub!(:new).with({'these' =>
'params'}).and_return(mock_event(:save => false))
106 post :create, :event => {:these => 'params'}
107 assigns(:event).should equal(mock_event)
108   end


RSPEC Test result

 should expose a newly created but unsaved event as @event

Mock 'Event_1039' received unexpected message :user_id= with (nil)

/home/leo/railsprojects/trunk/memorymap/app/controllers/
events_controller.rb:44:in `create'
./spec/controllers/events_controller_spec.rb:106:

42  def create
43@event = Event.new(params[:event])
44@event.user_id = session[:user_id]
45
46respond_to do |format|


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActiveLDAP why are you so cruel to me? Help Please

2008-10-15 Thread James Newport

Try replacing "ActiveLDAP::Base.connect" with
"ActiveLdap::Base.establish_connection"

James.

petr wrote:
> Ive got a ruby script to test ActiveLDAP to establish connection with
> the server:
> 
> require 'rubygems'
> require 'active_ldap'
> 
> ActiveLDAP::Base.connect(
>   :host => '192.168.1.40',
>   :port => 389,
>   :base => 'dc=webgate,dc=net,dc=au',
>   :bind_format => 'cn=Manager,dc=webgate,dc=net,dc=au',
>   :password_block => Proc.new { '' },
>   :allow_anonymous => false,
>   :try_sasl => false
> )
>
> Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Tinymce plugin problem in Opera and Google Chrome

2008-10-15 Thread Walter McGinnis
Which version of the plugin are you using?  I'm apart of the team that
maintains a version at http://github.com/kete/tiny_mce, you might want to
switch to using that.
Cheers,
Walter

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Handling nil.errors in error_messages_for

2008-10-15 Thread Sniper Abandon

Mark Richman wrote:
> How do you deal with multiple objects in error_messages_for when one or
> more may be nil?
> 
> For example:
> 
> <%= error_messages_for :object => [EMAIL PROTECTED], @account.billing_detail,
> @account.mailing_address, @account.billing_address] %>
> 
> Here, @account.billing_detail may be nil, and throw a NoMethodError.
> 
> Thanks,
> Mark

i don't know why you are trying in this way

anyway try this
<%= error_messages_for :object => [EMAIL PROTECTED], @account.billing_detail, 
@account.mailing_address, @account.billing_address].compact %>

by
mokkai
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Save selected checkboxes after remote_function call

2008-10-15 Thread Kim Griggs
yep, that was it. Thanks.

On Wed, Oct 15, 2008 at 7:44 PM, Mark James <[EMAIL PROTECTED]> wrote:

>
> Kim wrote:
>
> > <%= check_box_tag(db.id, db.id, session[:selected].include?
> > (db.id), :onclick => remote_function( :url => {:action =>
> > 'selected',:cid
> > => db.id})) %> <%=db.title%>
> >
> >
> > Any other suggestions?
>
> session[:selected].include?(db.id.to_s)
>
> --
> Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com
>
> >
>


-- 
Kim Griggs
[EMAIL PROTECTED]

"We are all stakeholders in the Karma economy."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails sessions working intermittently in IE7

2008-10-15 Thread Rick

I've noticed similar behavior on IE5 (I know, it's old, so am I:-)...

I only running in development mode and testing on Firefox, Safari,
Opera, and IE.  The only way I can terminate a session on IE is by
deleting related cookies.  The other browsers work fine.  I typically
run through mongrel though I've tried webrick with the same results.

Here's my setup:

Ruby version1.8.7 (powerpc-darwin9)
RubyGems version1.3.0
Rails version   2.1.1
Active Record version   2.1.1
Action Pack version 2.1.1
Active Resource version 2.1.1
Action Mailer version   2.1.1
Active Support version  2.1.1
Application root/Users/rick/journeys
Environment development
Database adaptermysql
Database schema version 20080925171956


On Oct 15, 12:10 pm, command0 <[EMAIL PROTECTED]> wrote:
> Is this just happening in IE7? Can you replicate the issue in other
> browsers like Chrome, Firefox, Safari, etc... ?
>
> On Oct 15, 4:00 pm, gwgeller <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > We are developing in Rails 2.1.0 and serving the files with mongrels
> > behind Apache. We are using SqlSessionStore. Recently I noticed that
> > when logging into our site using IE7 the session doesn't persist in
> > some situations, and persists when it shouldn't.
>
> > For instance when I log in my info is maintained when visiting certain
> > pages, but disappears on others. The info never fully disappears, it
> > just is only accessible certain situations. I can't log out either.
> > Lastly if I close IE7 and reopen the browser my session is still
> > active.
>
> > So here are some things to take into account - Everything works fine
> > in development using a similar mongrel/apache/ssl setup. This would
> > make me think it might be the live server, but we have another ror
> > site that works fine. I guess this doesn't eliminate the server.
>
> > What is puzzling is the session persists, but for some reason it
> > doesn't get recognized on some requests. It seems another session
> > would be created in those cases, but one is not when I view the
> > sessions table. Also the fact that I can't log out is weird.
>
> > Most of what I can find has to do with iframes and setting p3p in the
> > response, but that hasn't worked and it seems that in those cases the
> > session isn't persisting at all, which is different from our issue.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Save selected checkboxes after remote_function call

2008-10-15 Thread Mark James

Kim wrote:

> <%= check_box_tag(db.id, db.id, session[:selected].include?
> (db.id), :onclick => remote_function( :url => {:action =>
> 'selected',:cid
> => db.id})) %> <%=db.title%>
> 
> 
> Any other suggestions?

session[:selected].include?(db.id.to_s)

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Handling nil.errors in error_messages_for

2008-10-15 Thread Mark Richman

@account is an instance of class Account.

Account has_one BillingDetail
Account has_one MailingAddress
Account has_one BillingAddress

My issue is how to deal with nil references on the has_one associations. 
To my knowledge, the above syntax is the only way to deal with error 
messages in a multi-model form. I could have also done this:

<%= error_messages_for :object => [EMAIL PROTECTED], @billing_detail, 
@mailing_address, @billing_address] %>

having set these class variables in the controller, but that does not 
solve the nil issue.

Thanks,
Mark
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using an ActiveRecord class method within an ActionMailer object

2008-10-15 Thread David

I have installed and am using SMS-Fu:
http://brendanlim.com/2008/2/28/send-text-messages-from-rails-with-sms-fu,
which appears to be free to send sms messages.  Maybe there is a limit
with this, I am not sure, I read somewhere 500 max in any given 3 day
period but maybe it varies for different carriers?  What I would
really like is to be able to receive SMS for free, but it doesnt look
like its in the cards.

On Oct 15, 11:03 am, gaveeno <[EMAIL PROTECTED]> wrote:
> We are using a shared shortcode provided by another company, so nope
> it's not open source.  As far as I'm aware, open source SMS gateways
> such as Kannel still require that you have a shortcode leased and
> registered with the various carriers, which is really expensive.
> There's really doesn't seem to be any way to avoid a per-message cost
> for outgoing messages (many mobile gateway providers don't charge for
> incoming messages).
>
> David wrote:
> > What SMS gateway are you using if you don't mind me asking?  Is it
> > open source or are you paying per message?
>
> > On Oct 10, 10:18 am, gaveeno <[EMAIL PROTECTED]> wrote:
> > > When you ask if I really mean to be creating class instance variables,
> > > I assume you're referring to @incoming_message,
> > > @opt_or_feedback_object, @processing_notes =
> > > IncomingMessage.process_message()...correct? The reason I set class
> > > instance variables is because the view for this action needs to
> > > display details from the incoming message, the object created from the
> > > the incoming message, and the notes that are generated during
> > > processing (including the validation results mostly). I didn't paste
> > > the last line of the IncomingMessage.process_message() method above,
> > > but FYI it is "return
> > > @incoming_message,@opt_or_feedback_object,@processed_msg_array[0]".
>
> > > No, the reason is not that it's failing because of validations within
> > > the IncomingMessage.process_message() method, because the terminal
> > > window shows now SQL being executed, and also there are items
> > > persisted to the DB regardless of whether validation succeeds or
> > > fails. I took your tip and used breakpoints to see what's happening
> > > here (this is my first Rails app and I stupidly didn't think to look
> > > into the Rails debug tools). When aSMScomes in, the breakpoint at
> > > the start of the IncomingMessage.process_message() method is hit.
> > > However, when an email comes in, not breakpoints are hit, regardless
> > > of where they are. I.e. in the MailProcesser.receive() method, I put
> > > the following 2 lines:
> > > 1 puts "debug"
> > > 2 debugger
> > > The terminal window where I executed the script displays "debug", but
> > > processing does not stop at the breakpoint.
>
> > > This might help...it's the fetcher script that is daemonized (and I
> > > can post more of the code from the Fetcher plugin if you think that
> > > it'd be helpful):
>
> > > #!/usr/bin/env ruby
> > > require File.dirname(__FILE__) + '/../config/environment.rb'
>
> > > class MailFetcherDaemon < Daemon::Base
>
> > > @config = YAML.load_file("#{RAILS_ROOT}/config/mail.yml")
> > > @config = @config[RAILS_ENV].to_options
>
> > > @sleep_time = @config.delete(:sleep_time) || 60
> > > def self.start
> > > puts "Starting MailFetcherDaemon"
> > > @fetcher = Fetcher.create({:receiver =>
> > > MailProcessor}.merge(@config))
>
> > > loop do
> > > @fetcher.fetch
> > > sleep(@sleep_time)
> > > end
> > > end
>
> > > def self.stop
> > > puts "Stopping MailFetcherDaemon"
> > > end
>
> > > end
>
> > > MailFetcherDaemon.daemonize
>
> > > Thanks for your help!
> > > -Gavin
>
> > > On Oct 10, 12:41 pm, Frederick Cheung <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Oct 10, 5:32 pm, gaveeno <[EMAIL PROTECTED]> wrote:
>
> > > > > Anybody know why this isn't working for me?
>
> > > > Well you haven't said exactly what is happening, eg if you put a
> > > > breakpoint in create_incoming_message is it hit? have you tried
> > > > stepping through the code and seeing when it fails?
> > > > Could it be that creation of the incoming_message fails because of
> > > > validation? Do you really mean to be creating class instance
> > > > variables ?
>
> > > > Fred
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: No route matches "/MyTest/" with {:method=>:get} error...

2008-10-15 Thread Erol Fornoles

On Oct 16, 8:04 am, Jeff Eg <[EMAIL PROTECTED]> wrote:
> Mind sharing?  I am having the same problem and none of these solutions
> seem to work:
> Restarting WEBrick
> Changing the routes.rb file (or leaving it as is either)
> deleting the index file in the public folder
>
> my setup is almost exactly the same except I have /reportcard/ and
> report_card_controller.rb
>
> Any help is appreciated.
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.

The default route to your report_card_controller.rb would be mapped
as /report_card and not as /reportcard
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Associated Models and :dependent => :destroy

2008-10-15 Thread Erol Fornoles

On Oct 16, 7:58 am, Avi Ir <[EMAIL PROTECTED]> wrote:
> and my WorkbookContent model uses
> belongs_to :workbook_content, :dependent => :destroy 

Shouldn't this be:
belongs_to :workbook, :dependent => :destroy
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How do you associate "Notes" to many models?

2008-10-15 Thread Erol Fornoles

On Oct 16, 8:30 am, Bob Sanders <[EMAIL PROTECTED]>
wrote:
> I'm trying to find the best way to associate notes to many models. I
> have a table called notes, and the tables I wanted associated to those
> notes are:
>
> players
> teams
> parents
>
> To accomplish it, would my notes database column just have the
> following:
>
> Note
> -
> body:string
> player_id:integer
> team_id:integer
> parent_id:integer
>
> That does seem messy, so I don't know if that's correct. Is there a
> better approach to associate notes to many models?
> --
> Posted viahttp://www.ruby-forum.com/.

Does a note need to be associated with only one of the 3 tables for
each instance? If yes, take a look at has_many_polymorphs.

http://m.onkey.org/2007/8/14/excuse-me-wtf-is-polymorphs
http://blog.evanweaver.com/files/doc/fauna/has_many_polymorphs/files/README.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ruby on rails newbie please help cgi problem

2008-10-15 Thread Frederick Cheung


On 16 Oct 2008, at 01:32, Adam Hurlburt wrote:

>
> Frederick Cheung wrote:
>> On Oct 15, 3:49�am, Adam Hurlburt <[EMAIL PROTECTED] 
>> s.net>
>> wrote:
>>> configure it with mod rails?
>> Why aren't you just letting rails render your templates?
>>
>> Fred
>
> Im sorry Im really knew to rails, what are these templates and how  
> do I
> render them with rails.

It sounds to me like you just want to dump some rhtml templates  
somewhere and have ruby render them. That's fine, but that's  
fundamentally not how rails work.
Rails applications have a very specific structure. Your app splits  
into models, typically wrappers round a database table, controllers  
which sit between the outside world and your models, and views which  
are the .rhtml (now usually named .html.erb) files you were worrying  
about. Apache never touches a .rhtml file directly - it hands the  
request over to a rails worker (a mongrel, a fastcgi instance, a  
mod_rails instance) which does a bunch of stuff (which may include  
rendering one of the app's rhtml templates) and passes the response back
I could waffle about this more, but I think that you would have more  
to gain by reading one of the many rails tutorials (make sure you pick  
a fairly recent one). I'd also advise that you forget about apache for  
a second.
webrick/mongrel (which you can launch by running ruby script/server  
from the root of our app) are more than enough to get you going.

>
> I am also wondering is there any advantage to using rails if I write  
> my
> own login script / use the DBI module for database connectivity? It
> seems from what I have heard that rails is primarily useful due to its
> easy of deployment. I want to become more familiar with rails  
> because I
> keep hearing good things about it and it seems like it is quickly
> becoming very popular so I am just wondering what are the specific
> benefits?
>
While there are many great things about rails, I wouldn't call ease of  
deployment its main strength (if anything historically it has been  
what puts people off).

Fred
> Thanks,
>
> Adam
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] How do you associate "Notes" to many models?

2008-10-15 Thread Bob Sanders

I'm trying to find the best way to associate notes to many models. I
have a table called notes, and the tables I wanted associated to those
notes are:

players
teams
parents

To accomplish it, would my notes database column just have the
following:

Note
-
body:string
player_id:integer
team_id:integer
parent_id:integer

That does seem messy, so I don't know if that's correct. Is there a
better approach to associate notes to many models?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ruby on rails newbie please help cgi problem

2008-10-15 Thread Adam Hurlburt

Frederick Cheung wrote:
> On Oct 15, 3:49�am, Adam Hurlburt <[EMAIL PROTECTED]>
> wrote:
>> configure it with mod rails?
> Why aren't you just letting rails render your templates?
> 
> Fred

Im sorry Im really knew to rails, what are these templates and how do I 
render them with rails.

I am also wondering is there any advantage to using rails if I write my 
own login script / use the DBI module for database connectivity? It 
seems from what I have heard that rails is primarily useful due to its 
easy of deployment. I want to become more familiar with rails because I 
keep hearing good things about it and it seems like it is quickly 
becoming very popular so I am just wondering what are the specific 
benefits?

Thanks,

Adam
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Radio button issues in a list

2008-10-15 Thread Teresa Mcmillin

Frederick Cheung wrote:
> that third parameter is what will appear in params[:company]
> [:default_company] so typically you set it to something like
> @company.id.
> 
> Overwriting @company like that won't do you any favours, I would do
> 
>  <% for company in @companies %>
> 
>   <%= company.name %>
> <%= company.size %>
> <%= radio_button("company", "default_company", company.id) %>
> 
> <% end %>
> 
> Fred

I have changed the third parm and I see what you mean, but here is my 
confusion.  I thought the third parm was used for determining which 
radio
button should be selected, when loading the companies from the database. 
In my case, only one company has default set to true, so I put true in 
the third parm.  It works nicely for displaying the data.

So now the question becomes how do I set that radio button values to 
correspond to the database values?

Thanks for your help.

TMac
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Online Storefront Credit Cards

2008-10-15 Thread David

Thanks Benjamin, I will look into that.  Does anyone have any
experience with the same kind of payment disbursement with
authorize.net par chance?

On Oct 15, 4:18 pm, "Benjamin Curtis" <[EMAIL PROTECTED]>
wrote:
> If you were to use Braintree (http://www.braintreepaymentsolutions.com/) for
> your payment gateway and you got ACH processing, you could collect the funds
> from customers via your merchant account, then disburse payments via ACH,
> directly to checking accounts, all via ActiveMerchant.  This is exactly what
> I did in an app similar to yours for photographers:http://www.nextproof.com/
> --
> Benjamin Curtishttp://railskits.com/- Ready-made Rails 
> codehttp://catchthebest.com/- Team-powered 
> recruitinghttp://www.bencurtis.com/- Personal blog
>
> On Tue, Oct 14, 2008 at 10:57 PM, David <[EMAIL PROTECTED]> wrote:
>
> > Yea, thats what I thought, but I spoke with Authorize.net on the phone
> > today and they are saying that the only way to distribute the payment
> > is to go through email receipts by hand.  I need an automated way of
> > transfering these funds to individual checking accounts.
>
> > On Oct 14, 10:28 pm, "Hassan Schroeder" <[EMAIL PROTECTED]>
> > wrote:
> > > On Tue, Oct 14, 2008 at 4:59 PM, David <[EMAIL PROTECTED]> wrote:
> > > > ... an online art venue where members can each have his/her own
> > > > online store front.  I want to be able to handle credit card
> > > > transactions in such a way that each member can receive payment for
> > > > the art that they sell.  It seems that most credit card verification
> > > > sites such as Authorize.net are set up so that you are the
> > > > storefront.  Im wondering what the best route is for managing credit
> > > > card transactions for an array of storefronts all under your
> > > > umbrella.
>
> > > So what's wrong with your having a merchant account, processing
> > > the payments and distributing the money?
>
> > > That's what a brick-and-mortar gallery does. And it's a value-add for
> > > your vendors who don't want to set up a merchant account of their
> > > own, for whatever reason. Keeping track of who sold what shouldn't
> > > be too tough :-)
>
> > > FWIW,
> > > --
> > > Hassan Schroeder  [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: why do I get 1 as id for all locations??

2008-10-15 Thread Jay Pangmi

Never mind, I fixed it.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Keep getting "Undefined local variable or method" when creating a new rails application

2008-10-15 Thread Frederick Cheung


On 15 Oct 2008, at 23:07, command0 wrote:

>
> Oh Yes, and I forgot to mention I step I did in between. After
> generating the scaffold, then I'd migrate the database.
>
script/generate scaffold is expecting the singular name, not the plural.

Fred

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: No route matches "/MyTest/" with {:method=>:get} error...

2008-10-15 Thread Jeff Eg

Tom Chen wrote:
> Nvm, I figured it out.

Mind sharing?  I am having the same problem and none of these solutions 
seem to work:
Restarting WEBrick
Changing the routes.rb file (or leaving it as is either)
deleting the index file in the public folder

my setup is almost exactly the same except I have /reportcard/ and 
report_card_controller.rb

Any help is appreciated.
Thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Associated Models and :dependent => :destroy

2008-10-15 Thread Avi Ir

Hello,

I'm a rails beginner and I would appreciate any help on this problem.

I have two models, Workbook and WorkbookContent.  Workbook holds
uploaded Excel workbooks (through attachment_fu).  I want to parse the
data into fields in WorkbookContent.

My Workbook model uses
has_one :workbook_content, :dependent => :destroy 

and my WorkbookContent model uses
belongs_to :workbook_content, :dependent => :destroy 

My understanding is that, if Workbook includes the dependent => destroy
property, all its children will be destroyed upon its destruction.
However, when I look in the MySQL database, I can see that the child is
not being destroyed.  Is this something I am doing wrong with my
migration?  My migration for workbook__contents currently contains the
code:
t.references :workbook
which I found while scouring the internet.  Before, I had no explicit
mention of workbook and did not explicitly create a workbook_id column.

I don't understand why I can't get the child to be destroyed.  Any help
would be greatly appreciated!

Also, if anyone can guide me to some good reference materials on
associated models, I would be very grateful.

Thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Radio button issues in a list

2008-10-15 Thread Frederick Cheung



On Oct 16, 12:01 am, Teresa Mcmillin <[EMAIL PROTECTED]
s.net> wrote:
>     <%= radio_button("company", "default_company", true) %>

that third parameter is what will appear in params[:company]
[:default_company] so typically you set it to something like
@company.id.

Overwriting @company like that won't do you any favours, I would do

 <% for company in @companies %>

  <%= company.name %>
<%= company.size %>
<%= radio_button("company", "default_company", company.id) %>

<% end %>

Fred


> 
>   <% end %>
>   
>   <%= submit_tag "Change Default" %>
> <% end %>
>
> From this list, the user is allowed to change the default company and
> click on a button (implemented with a submit tag, which calls a method
> in the controller).  The radio buttons are the only editable field on
> this form.
>
> Question:  How do I get the necessary values back to the controller?
> Currently, I only get the selected radio button, but not the associated
> company data.
>
> TIA,
>
> TMac
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Online Storefront Credit Cards

2008-10-15 Thread Benjamin Curtis
If you were to use Braintree (http://www.braintreepaymentsolutions.com/) for
your payment gateway and you got ACH processing, you could collect the funds
from customers via your merchant account, then disburse payments via ACH,
directly to checking accounts, all via ActiveMerchant.  This is exactly what
I did in an app similar to yours for photographers:
http://www.nextproof.com/
--
Benjamin Curtis
http://railskits.com/ - Ready-made Rails code
http://catchthebest.com/ - Team-powered recruiting
http://www.bencurtis.com/ - Personal blog





On Tue, Oct 14, 2008 at 10:57 PM, David <[EMAIL PROTECTED]> wrote:

>
> Yea, thats what I thought, but I spoke with Authorize.net on the phone
> today and they are saying that the only way to distribute the payment
> is to go through email receipts by hand.  I need an automated way of
> transfering these funds to individual checking accounts.
>
> On Oct 14, 10:28 pm, "Hassan Schroeder" <[EMAIL PROTECTED]>
> wrote:
> > On Tue, Oct 14, 2008 at 4:59 PM, David <[EMAIL PROTECTED]> wrote:
> > > ... an online art venue where members can each have his/her own
> > > online store front.  I want to be able to handle credit card
> > > transactions in such a way that each member can receive payment for
> > > the art that they sell.  It seems that most credit card verification
> > > sites such as Authorize.net are set up so that you are the
> > > storefront.  Im wondering what the best route is for managing credit
> > > card transactions for an array of storefronts all under your
> > > umbrella.
> >
> > So what's wrong with your having a merchant account, processing
> > the payments and distributing the money?
> >
> > That's what a brick-and-mortar gallery does. And it's a value-add for
> > your vendors who don't want to set up a merchant account of their
> > own, for whatever reason. Keeping track of who sold what shouldn't
> > be too tough :-)
> >
> > FWIW,
> > --
> > Hassan Schroeder  [EMAIL PROTECTED]
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Radio button issues in a list

2008-10-15 Thread Teresa Mcmillin

Hi,

I have a list of companies for a given user.  One (and only one) company
can be a default company for that user.  I have a radio button that
appears on each row in the list of companies (here is my code):

<% form_tag :action => 'update_default_company', :id => @company,
:method => :post do %>
  

<%= "Name" %>
<%= "Size" %>
<%= "Default Company" %>


  <% for @company in @companies %>

  <%= @company.name %>
<%= @company.size %>
<%= radio_button("company", "default_company", true) %>

  <% end %>
  
  <%= submit_tag "Change Default" %>
<% end %>

>From this list, the user is allowed to change the default company and
click on a button (implemented with a submit tag, which calls a method
in the controller).  The radio buttons are the only editable field on
this form.

Question:  How do I get the necessary values back to the controller?
Currently, I only get the selected radio button, but not the associated
company data.

TIA,

TMac
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem with new action

2008-10-15 Thread JHuizingh

Christina,

Thanks for the response.

This is what my rake routes command outputs.  The
encryption_passphrases resource is at the top of everything in the
application.  The :controller/:action/:id route is at the very bottom.


  encryption_passphrases GET/
encryption_passphrases
{:controller=>"encryption_passphrases", :action=>"index"}
formatted_encryption_passphrases GET/
encryption_passphrases.:format
{:controller=>"encryption_passphrases", :action=>"index"}
 POST   /
encryption_passphrases
{:controller=>"encryption_passphrases", :action=>"create"}
 POST   /
encryption_passphrases.:format
{:controller=>"encryption_passphrases", :action=>"create"}
   new_encryption_passphrase GET/encryption_passphrases/
new
{:controller=>"encryption_passphrases", :action=>"new"}
 formatted_new_encryption_passphrase GET/encryption_passphrases/
new.:format
{:controller=>"encryption_passphrases", :action=>"new"}
  edit_encryption_passphrase GET/
encryption_passphrases/:id/edit
{:controller=>"encryption_passphrases", :action=>"edit"}
formatted_edit_encryption_passphrase GET/
encryption_passphrases/:id/edit.:format
{:controller=>"encryption_passphrases", :action=>"edit"}
   encryption_passphrase GET/
encryption_passphrases/:id
{:controller=>"encryption_passphrases", :action=>"show"}
 formatted_encryption_passphrase GET/
encryption_passphrases/:id.:format
{:controller=>"encryption_passphrases", :action=>"show"}
 PUT/
encryption_passphrases/:id
{:controller=>"encryption_passphrases", :action=>"update"}
 PUT/
encryption_passphrases/:id.:format
{:controller=>"encryption_passphrases", :action=>"update"}
 DELETE /
encryption_passphrases/:id
{:controller=>"encryption_passphrases", :action=>"destroy"}
 DELETE /
encryption_passphrases/:id.:format
{:controller=>"encryption_passphrases", :action=>"destroy"}
.
.
. {other controllers}
.
/:controller/:action/:id
/:controller/:action/:id.:format



I've worked around the issue by causing the index action to call the
create method, but I'd rather have it work as designed...

Any other suggestions?

Thanks,
Jonathan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How can form data be used to make an XML file?

2008-10-15 Thread Freddy Andersen

Why don't you just save the data to the database and serve it as xml
when the xml is needed? This way you can do more than just xml with
the data?

If that's not an option you can setup a session model that can store
the data when it comes back to the controller... Just setup form_tags
that has student_1 student_2 ... and save the data one by one...

I'm thinking student_form has_many students and just use the
database...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Zooppa.com - You have been invited to join!

2008-10-15 Thread [EMAIL PROTECTED]

Sorry guys, was testing a feature from where I work, idiotically
implemented by a guy that decided to spam the *whole* addressbook of
gmail, probably because it was "simpler".
Sorry for the spam people.

  ngw
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Handling nil.errors in error_messages_for

2008-10-15 Thread command0

Now, is @account a variable or a class? I could be way off in left
field, but it looks like your calling objects that should be from a
class. Variables should only be called by themselves typically.

On Oct 15, 3:59 pm, Mark Richman <[EMAIL PROTECTED]>
wrote:
> How do you deal with multiple objects in error_messages_for when one or
> more may be nil?
>
> For example:
>
> <%= error_messages_for :object => [EMAIL PROTECTED], @account.billing_detail,
> @account.mailing_address, @account.billing_address] %>
>
> Here, @account.billing_detail may be nil, and throw a NoMethodError.
>
> Thanks,
> Mark
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails sessions working intermittently in IE7

2008-10-15 Thread command0

Is this just happening in IE7? Can you replicate the issue in other
browsers like Chrome, Firefox, Safari, etc... ?

On Oct 15, 4:00 pm, gwgeller <[EMAIL PROTECTED]> wrote:
> Hello,
> We are developing in Rails 2.1.0 and serving the files with mongrels
> behind Apache. We are using SqlSessionStore. Recently I noticed that
> when logging into our site using IE7 the session doesn't persist in
> some situations, and persists when it shouldn't.
>
> For instance when I log in my info is maintained when visiting certain
> pages, but disappears on others. The info never fully disappears, it
> just is only accessible certain situations. I can't log out either.
> Lastly if I close IE7 and reopen the browser my session is still
> active.
>
> So here are some things to take into account - Everything works fine
> in development using a similar mongrel/apache/ssl setup. This would
> make me think it might be the live server, but we have another ror
> site that works fine. I guess this doesn't eliminate the server.
>
> What is puzzling is the session persists, but for some reason it
> doesn't get recognized on some requests. It seems another session
> would be created in those cases, but one is not when I view the
> sessions table. Also the fact that I can't log out is weird.
>
> Most of what I can find has to do with iframes and setting p3p in the
> response, but that hasn't worked and it seems that in those cases the
> session isn't persisting at all, which is different from our issue.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Zooppa.com - You have been invited to join!

2008-10-15 Thread nicholas . wieland

[EMAIL PROTECTED] ti ha mandato questo invito per farti conoscere Zooppa.com: 
il sito web che ti ricompensa in denaro se crei semplici pubblicità e partecipi 
attivamente.

Clicca il link sottostante per registrarti al sito 
http://it.zooppa.com/signup

Dopo la registrazione puoi immediatamente vincere 50 Zoop$ semplicemente 
completando il tuo profilo (convertibili in dollari veri alla quota di 1000).

Unisciti alla community di Zooppa. Invia un’idea, una grafica, un audio-file, 
un banner o un video per i concorsi on air: anche tu puoi vincere perchè è la 
community stessa che vota gli ads migliori.

ZOOPPA STAFF


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Keep getting "Undefined local variable or method" when creating a new rails application

2008-10-15 Thread command0

Oh Yes, and I forgot to mention I step I did in between. After
generating the scaffold, then I'd migrate the database.

prompt>rake db:migrate

Just wanted to throw that in there so nobody mentions me missing that
step, lol :P

Thanks,

Justin

On Oct 15, 3:57 pm, command0 <[EMAIL PROTECTED]> wrote:
> Hi, I'm fairly a noob to rails, and just trying to grasp the entire
> structure and concept. I think I'm getting it for the most part, but
> just can't seem to get past this error.
>
> I keep getting "Action Controller" page with the error:
>
> "undefined local variable or method `new_courses_path' for
> #".
>
> Ok, so let me tell you what I am doing so that you can understand. I
> create a mysql connected rails app called training. So there is no
> confusion, I have already created the database, and it works fine.
>
> prompt>rails -d mysql training
>
> Ok, so that is created. Then I create a scaffold to save time from
> having to create the model, view, and controller. And I create it
> telling it which db fields to create with it. To make this example
> simple, I'll just do 3 db fields: title (the course title) of varchar,
> description (course description) as text, and course_num (to locate
> the course faster in the db) as an integer.
>
> prompt>cd training
> prompt>script/generate scaffold courses \
>
> > title:string description:text course_num:integer
>
> And then I hit enter. It generates my model, view, and controller for
> me, so then I fire up Mongrel.
>
> prompt>script\server
>
> And then I go to localhost:3000/courses in my browser, and thats when
> I get the error. I just cannot figure it out. I've created another app
> with different names, bla bla bla, and it worked fine. Its just got me
> stumped.
>
> If someone could help me get some insight on the issue, it'd be much
> appreciated.
>
> Thanks,
>
> Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Rails sessions working intermittently in IE7

2008-10-15 Thread gwgeller

Hello,
We are developing in Rails 2.1.0 and serving the files with mongrels
behind Apache. We are using SqlSessionStore. Recently I noticed that
when logging into our site using IE7 the session doesn't persist in
some situations, and persists when it shouldn't.

For instance when I log in my info is maintained when visiting certain
pages, but disappears on others. The info never fully disappears, it
just is only accessible certain situations. I can't log out either.
Lastly if I close IE7 and reopen the browser my session is still
active.

So here are some things to take into account - Everything works fine
in development using a similar mongrel/apache/ssl setup. This would
make me think it might be the live server, but we have another ror
site that works fine. I guess this doesn't eliminate the server.

What is puzzling is the session persists, but for some reason it
doesn't get recognized on some requests. It seems another session
would be created in those cases, but one is not when I view the
sessions table. Also the fact that I can't log out is weird.

Most of what I can find has to do with iframes and setting p3p in the
response, but that hasn't worked and it seems that in those cases the
session isn't persisting at all, which is different from our issue.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Handling nil.errors in error_messages_for

2008-10-15 Thread Mark Richman

How do you deal with multiple objects in error_messages_for when one or
more may be nil?

For example:

<%= error_messages_for :object => [EMAIL PROTECTED], @account.billing_detail,
@account.mailing_address, @account.billing_address] %>

Here, @account.billing_detail may be nil, and throw a NoMethodError.

Thanks,
Mark
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Keep getting "Undefined local variable or method" when creating a new rails application

2008-10-15 Thread command0

Hi, I'm fairly a noob to rails, and just trying to grasp the entire
structure and concept. I think I'm getting it for the most part, but
just can't seem to get past this error.

I keep getting "Action Controller" page with the error:

"undefined local variable or method `new_courses_path' for
#".

Ok, so let me tell you what I am doing so that you can understand. I
create a mysql connected rails app called training. So there is no
confusion, I have already created the database, and it works fine.

prompt>rails -d mysql training

Ok, so that is created. Then I create a scaffold to save time from
having to create the model, view, and controller. And I create it
telling it which db fields to create with it. To make this example
simple, I'll just do 3 db fields: title (the course title) of varchar,
description (course description) as text, and course_num (to locate
the course faster in the db) as an integer.

prompt>cd training
prompt>script/generate scaffold courses \
> title:string description:text course_num:integer

And then I hit enter. It generates my model, view, and controller for
me, so then I fire up Mongrel.

prompt>script\server

And then I go to localhost:3000/courses in my browser, and thats when
I get the error. I just cannot figure it out. I've created another app
with different names, bla bla bla, and it worked fine. Its just got me
stumped.

If someone could help me get some insight on the issue, it'd be much
appreciated.

Thanks,

Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: repond_to? bug, really strange

2008-10-15 Thread Jeff

On Oct 15, 3:33 pm, Ben Johnson <[EMAIL PROTECTED]>
wrote:
> This is really strange:
>
> >> User.send(:merge_joins, "one", "two")
> => ["one", "two"]
> >> User.respond_to?(:merge_joins)
>
> => false
>
> Am I missing something here? Shouldn't the respond_to return true?
>
> thanks for your help
> --
> Posted viahttp://www.ruby-forum.com/.

If User is actually using method_missing to handle the merge_joins
message, then respond_to? won't be able to see it.


Jeff

purpleworkshops.com
softiesonrails.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How can form data be used to make an XML file?

2008-10-15 Thread Rock Roll

The XML would be for example


   
   

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: repond_to? bug, really strange

2008-10-15 Thread Frederick Cheung



On 15 Oct 2008, at 21:33, Ben Johnson <[EMAIL PROTECTED] 
s.net> wrote:

>
> This is really strange:
>
>>> User.send(:merge_joins, "one", "two")
> => ["one", "two"]
>>> User.respond_to?(:merge_joins)
> => false
>
> Am I missing something here? Shouldn't the respond_to return true?
>
By default respond_to returns false if a method is private (such as  
merge_joins) but send ignores privateness and protectedness

Fred
> thanks for your help
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] How can form data be used to make an XML file?

2008-10-15 Thread Rock Roll

I have a scenario. Ignore this if it is silly. I have a form like a data
entry. It has 3 fields which are name, age and gender. The guy who
enters the data adds more fields with the help of an Add another Entry
link which brings a set of the 3 fields with the help of a partial which
has the form with 3 fields. After he finishes all the entries he Submits
which must generate an XML file which will be saved in the file system.
My question is how to pass the set of entered data to create the XML.
XML can be built using XML builder function and file can be saved. But i
need to know how this data can be passed to the controller for XML
generation. Please help. Thank you
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] repond_to? bug, really strange

2008-10-15 Thread Ben Johnson

This is really strange:

>> User.send(:merge_joins, "one", "two")
=> ["one", "two"]
>> User.respond_to?(:merge_joins)
=> false

Am I missing something here? Shouldn't the respond_to return true?

thanks for your help
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to configure a server with new development environment

2008-10-15 Thread Mm Zz

Sunny Bogawat wrote:
> Hi,
>  In my application i created a new environment  say sunny for
> development purpose.
>   currently i am start server using command
>ruby script/server -e sunny
> 
>  but i want to configure it in aptana(editor), but it not showing
> environment as sunny

Not exactly sure i understand the question, but you can create configs 
for the enviornment here:
config/environments/sunny.rb

Check out the other .rb files in config/environments for some example 
content.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActionView: render a layout not in app/views?

2008-10-15 Thread Matthew Rudy Jacobs

Matthew Rudy Jacobs wrote:
tthew Rudy Jacobs <[EMAIL PROTECTED]
> 
> Hey thanks andrew,
> that's the same thing I'm trying to achieve,
> although the code as such won't quite work in Rails 2.1.1
> 
> it'll give you errors about "found a view path that is not in the right 
> format"
> 
> the correct way is
>   append_view_path(...)
> 
> and you pointed out my error
> 
> I was doing;
>   append_view_path("public/sites")
> 
> while actually what is required;
>   append_view_path(File.join(Rails.root, "public", "sites"))
> 
> works great, it seems.
> Thanks.

Wrote a quick blog post about this;
http://rudygems.com/post/54730156/rendering-layouts-that-live-in-public
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using Rails purely as a RESTful web service (no or little HTML)

2008-10-15 Thread Marcos

> I disagree but find the approach very interesting. What CMS are you
> going to use? And how closely would you bind them? Would you use rails
> for all db transactions, or just for specific business logic?

The reason I say this is that the kind of app I'd like to build
(accountancy app), clients would generally want it to be fully branded
and part of their website. If I used a CMS with a plugin (that's
essentially a RESTful client) they could customise (Google says I
should spell that with a 'z'!) to their heart's content. Move menu's
about, hide menus, completely change everything around. The
accountancy software itself would essentially be a web service, that
many different types of client could use. I suppose one could use
either an iframe (urgh) or some kind of lightweight proxy that just
goes as gets the HTML interface, with client specific stylesheet. But
I'm not sure that's any better. (an added, but not insurmounable,
problem in that case would be ensuring you had a continuations proxy
to support comet requests)

For the CMS (if I go this approach, big 'if') it's a toss-up between
Drupal and Joomla. Drupal, for me, has the edge though - I just find
the way it works more logical. Plus it has a built in http-client
method. Not a biggie - but nice it's there out of the box.

Basically, I just see you get so much for free with a CMS that clients
would love. Want a calender? No problem, install the module, choose a
place for it. Done in literally a few minute. I know Rails is fast,
but not that fast :) You can add loads of things so easily. Many
potential clients I know still use static web sites that they pay
someone just to add a news item, so they'd probably go with the CMS.

> Would you maintain separate databases or adapt Rails to work with the
> CMS db (possible, though to me that kind of thing always seems a
> little kludgy) or the other way around?

Essentially, the CMS would be a view/controller, and the rails web app
the model. I certainly wouldn't want to keep any state in the local
CMS DB that was required in another client. I also wouldn't want the
Rails web service to work with the CMS DB, chiefly because I don't
necessarily want i on the same box, and would completely spoil the
independence anyway. I'd think of the CMS plugin as purely an client.
I could have other clients like a native app, an iphone app, even a
integrate with an Excel spreadsheet (urghh!!!). Essentially one should
be able to pick up any of those clients, and not see any difference in
the data. A bit like reading your IMAP email both in Thunderbird and
Google Mail. The only things in the CMS DB would effectively be the
the client settings.

As a sort of pros/cons, what do you think of this?:

DIrect Rails app

1) Better performance - you're running one thing. Plus it would be on
one server - I expect HTTP requests would be significantly slower than
straight ActiveRecord/DB requests.
2) Simpler setup (using only one stack, no need for PHP etc)
3) No need to upgrade the 'client'
4) Fair easy stylesheet customization

1) Not as easy to customise menus, forms etc. Could add write this
functionality yourself, but would take time. There' DRY, and then
there's DRO (don't repeat others :)
2) Harder to properly integrate into a clients website - or
3) Client must direct their users to a separate URL

Drupal + RESTful Rails app

1) Decoupling encourages a design that makes it easier to add other
clients
2) Can easily add CMS plugins to add standard functionality, of which
there are hundreds.
3) Much easier to customise. Say the client doesn't want to see a menu
for x, because it's not relevant. No problem - they could probably
even do it themselves. The accounting plugin would be the client's app
- customised as much as they are willing to pay for.

1) All these client customisations could be nightmare to manage
2) New or changed features could break clients
3) Would be technically slower - they question is would it be slower
on the human scale (ie 100ms might be ten time as slow as 10ms, but
it's still only 100ms)
4) More loads on the server - assuming the CMS is on the same server.
5) More complex setup

> I'm just curious. Feel free to tell me to go away if you want.

Quite the contrary - very happy someone's taken an interest! Happy to
hear any opinions.

Thanks

Marcos
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] How to Catch a Status 401 with htpasswd?

2008-10-15 Thread Mar Zig

Hi All,

I would love to hear your thoughts on this.

I am using the htpasswd plugin located here:
http://wota.jp/svn/rails/plugins/branches/stable/htpasswd/

To validate access against a .htpasswd file.  The plugin is working
great but currently if you fail to get the PW correct and generate a 401
(Unauthorized) the user is presented with a completely blank page.

My goal is to at least redirect them to the home page or present a
message saying their login attempts have failed.


Here is what i have tried:
#application.rb
  rescue_from Htpasswd::UnknownUserAccount, :with => :http_status_code

def http_status_code
  redirect_to "http://someplace.com";
end

 ^ The above does nothing and does NOT catch anything.  I have tried
with Htpasswd::Error, and ActiveResource::UnauthorizedAccess  --
nothing.



I have also tried a before filter with a method in application.rb
calling htpasswd but i get an error saying the htpasswd method does not
exist.

Any input or even a starting place where i can begin researching would
be great .


THANK YOU!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Could not find RubyGem - because it's not a gem

2008-10-15 Thread Daniel Berger



On Oct 15, 11:43 am, Daniel Berger <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Why doesn't a require in my environment.rb file search the standard
> site_lib path?
>
> # works
> irb(main):001:0> require 'strongtyping'
> => true
>
> # doesn't work
> C:\>ruby script\server
> => Booting WEBrick...
> C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:628:in
> `report_activate_error': Could not find RubyGem strongtyping (>= 0)
> (Gem::LoadError)

BTW, this is Ruby 1.8.6-p114, Windows XP, Rails 2.1.1

Regards,

Dan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to let a user render a partial?

2008-10-15 Thread scott

how about doing something like this logic

scan your content looking for "{"
store everything until your next "}" into a string variable # now
string = "test foo:foo bar bar:bar foo"
split your string by spaces into an array # now array = ["test",
"foo:foo", "bar", "bar:bar", "foo"]

loop through your array
new_array = []
index = 0
array.each do |a|
if a does not contain ":"
index = index + 1
partial = a
args = {}
new_array[index] = [partial, args]
else
args = new_array[index][2] # should be a hash
name, value = a.split(/:/)
args[name.to_sym] = value # add new args to hash
new_array[index][2] = args # store hash back into the array
end
end

# now new_array = [["foo", {foo => "foo"}], ["bar", {bar => "bar"}],
["foo", {}]]
loop through this and render partials
new_array.each do |a|
partial = a[1]
arguments = a[2]
output << render(:partial => "drops/#{partial}", :locals =>
arguments)
end

i am sure there are errors and bugs but i think the basic logic should
work. it will probably turn out to be fairly clean and readable if
refactored into a few methods.


On Oct 15, 6:01 am, David Trasbo <[EMAIL PROTECTED]>
wrote:
> David Trasbo wrote:
> > ==
> > def dropify(content)
> >   s = StringScanner.new(content)
> >   output = ""
> >   previous_end = 0
> >   while s.scan_until(/\{/)
> >     output << content[previous_end, s.pointer - previous_end - 1]
> >     partial =  s.scan(/\w+/)
> >     s.skip /\s+/
> >     arguments = {}
> >     while argument = s.scan(/\w+:\w+/)
> >       name, value = argument.split(/:/)
> >       arguments[name.to_sym] = value
> >       s.skip /\s+/
> >     end
> >     s.skip_until /\}/
> >     previous_end = s.pointer
> >     output << render(:partial => "drops/#{partial}", :locals =>
> > arguments)
> >   end
> >   output << content[s.pointer, content.length - s.pointer]
> > end
> > ==
>
> Okay, I actually have a concern about this method. Right now it only
> accepts this kind of syntax:
>
> {test foo:foo_bar}
>
> Since spaces are not covered by \w+ this is not accepted:
>
> {test foo:foo bar}
>
> So I tried changing \w+ to .+ but of course that is never going to work.
> E.g. if I try to pass multiple arguments to the partial like this:
>
> {test foo:foo bar bar:bar foo}
>
> then only one argument will only be passed (foo) and it will have this
> value: "foo bar bar" because the .+ includes that.
>
> But what about putting quotation marks around it?
>
> ".+"
>
> Still the same problem. Now foo will just have this value: "“foo bar”
> bar". So, here is my question: How can I make this method accept
> multiple arguments without being limited to that the values have to
> match "\w+"?
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using an ActiveRecord class method within an ActionMailer object

2008-10-15 Thread gaveeno

We are using a shared shortcode provided by another company, so nope
it's not open source.  As far as I'm aware, open source SMS gateways
such as Kannel still require that you have a shortcode leased and
registered with the various carriers, which is really expensive.
There's really doesn't seem to be any way to avoid a per-message cost
for outgoing messages (many mobile gateway providers don't charge for
incoming messages).

David wrote:
> What SMS gateway are you using if you don't mind me asking?  Is it
> open source or are you paying per message?
>
> On Oct 10, 10:18�am, gaveeno <[EMAIL PROTECTED]> wrote:
> > When you ask if I really mean to be creating class instance variables,
> > I assume you're referring to @incoming_message,
> > @opt_or_feedback_object, @processing_notes =
> > IncomingMessage.process_message()...correct? �The reason I set class
> > instance variables is because the view for this action needs to
> > display details from the incoming message, the object created from the
> > the incoming message, and the notes that are generated during
> > processing (including the validation results mostly). �I didn't paste
> > the last line of the IncomingMessage.process_message() method above,
> > but FYI it is "return
> > @incoming_message,@opt_or_feedback_object,@processed_msg_array[0]".
> >
> > No, the reason is not that it's failing because of validations within
> > the IncomingMessage.process_message() method, because the terminal
> > window shows now SQL being executed, and also there are items
> > persisted to the DB regardless of whether validation succeeds or
> > fails. �I took your tip and used breakpoints to see what's happening
> > here (this is my first Rails app and I stupidly didn't think to look
> > into the Rails debug tools). �When aSMScomes in, the breakpoint at
> > the start of the IncomingMessage.process_message() method is hit.
> > However, when an email comes in, not breakpoints are hit, regardless
> > of where they are. �I.e. in the MailProcesser.receive() method, I put
> > the following 2 lines:
> > 1 � � puts "debug"
> > 2 � � debugger
> > The terminal window where I executed the script displays "debug", but
> > processing does not stop at the breakpoint.
> >
> > This might help...it's the fetcher script that is daemonized (and I
> > can post more of the code from the Fetcher plugin if you think that
> > it'd be helpful):
> >
> > #!/usr/bin/env ruby
> > require File.dirname(__FILE__) + '/../config/environment.rb'
> >
> > class MailFetcherDaemon < Daemon::Base
> >
> > � @config = YAML.load_file("#{RAILS_ROOT}/config/mail.yml")
> > � @config = @config[RAILS_ENV].to_options
> >
> > � @sleep_time = @config.delete(:sleep_time) || 60
> > � def self.start
> > � � puts "Starting MailFetcherDaemon"
> > � � @fetcher = Fetcher.create({:receiver =>
> > MailProcessor}.merge(@config))
> >
> > � � loop do
> > � � � @fetcher.fetch
> > � � � sleep(@sleep_time)
> > � � end
> > � end
> >
> > � def self.stop
> > � � puts "Stopping MailFetcherDaemon"
> > � end
> >
> > end
> >
> > MailFetcherDaemon.daemonize
> >
> > Thanks for your help!
> > -Gavin
> >
> > On Oct 10, 12:41�pm, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
> >
> > > On Oct 10, 5:32�pm, gaveeno <[EMAIL PROTECTED]> wrote:
> >
> > > > Anybody know why this isn't working for me?
> >
> > > Well you haven't said exactly what is happening, eg if you put a
> > > breakpoint in create_incoming_message is it hit? have you tried
> > > stepping through the code and seeing when it fails?
> > > Could it be that creation of the incoming_message fails because of
> > > validation? Do you really mean to be creating class instance
> > > variables ?
> >
> > > Fred
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Small regular expression question

2008-10-15 Thread Tim McIntyre

I'd check out the ruby URI module:

http://www.ruby-doc.org/core/classes/URI.html

It's a more complex problem than it appears at first glance.

good luck!

On Oct 15, 7:44 am, Joe Peck <[EMAIL PROTECTED]> wrote:
> I'm looking to write a regular expression that will match valid URLs.
> My problem is that it almost works, except it accepts URLs with / in the
> middle of them, suchs as:http://www.ruby/rails.com
>
> It looks (to me) like my regular expression should not match strings
> like that, but it does.  Here is the regular expression:
>
> .match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).*$/ix)
>
> How can I make it not accept URLs with / in the middle of them?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Small regular expression question

2008-10-15 Thread Joe Peck

Frederick Cheung wrote:
> On 15 Oct 2008, at 15:44, Joe Peck wrote:
> 
>> .match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).* 
>> $/ix)
>>
>> How can I make it not accept URLs with / in the middle of them?
> 
> for the record, the problem here is .* at the end
> ^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+)
> matches against
> http://www.ruby
> and the remainder (/rails.com) trivially matches against .*
> 
> Fred

Thanks, I don't know how I missed that.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Could not find RubyGem - because it's not a gem

2008-10-15 Thread Frederick Cheung


On 15 Oct 2008, at 18:43, Daniel Berger wrote:

>
> Hi all,
>
> Why doesn't a require in my environment.rb file search the standard
> site_lib path?
>
> # works
> irb(main):001:0> require 'strongtyping'
> => true
>
> # doesn't work
> C:\>ruby script\server
> => Booting WEBrick...
> C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:628:in
> `report_activate_error': Could not find RubyGem strongtyping (>= 0)
> (Gem::LoadError)


That sort of thing works fine for me. The ruby-talk list may be able  
to offer more help with this.

Fred

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Small regular expression question

2008-10-15 Thread Frederick Cheung


On 15 Oct 2008, at 15:44, Joe Peck wrote:

>
> I'm looking to write a regular expression that will match valid URLs.
> My problem is that it almost works, except it accepts URLs with / in  
> the
> middle of them, suchs as:
> http://www.ruby/rails.com
>
> It looks (to me) like my regular expression should not match strings
> like that, but it does.  Here is the regular expression:
>
> .match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).* 
> $/ix)
>
> How can I make it not accept URLs with / in the middle of them?

for the record, the problem here is .* at the end
^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+)
matches against
http://www.ruby
and the remainder (/rails.com) trivially matches against .*

Fred

>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: login from token

2008-10-15 Thread Thorsten Müller

I would simply store the request uri in the session,
redirect the user to the login page and after successful
login redirect him to the requested page.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Could not find RubyGem - because it's not a gem

2008-10-15 Thread Daniel Berger

Hi all,

Why doesn't a require in my environment.rb file search the standard
site_lib path?

# works
irb(main):001:0> require 'strongtyping'
=> true

# doesn't work
C:\>ruby script\server
=> Booting WEBrick...
C:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:628:in
`report_activate_error': Could not find RubyGem strongtyping (>= 0)
(Gem::LoadError)

Regards,

Dan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: login from token

2008-10-15 Thread Pardee, Roy
If you want navigation to a URL to actually log a specific person in, the 
tokens will have to be person-specific, won't they?  What do you imagine the 
mechanics would be for getting a sending user to generate one of those URLs?  
Are you trading recipient-convenience for sender-inconvenience?

Would setting this up allow potential-senders to impersonate anyone by 
generating and then navigating to one of these URLs?

As an alternative, consider setting a long-lived cookie when a user logs in, 
and check for its presence as part of your authentication routine (e.g., if 
cookie exists, assume they are legit & pass them on to the destination page).  
That should cut down on the number of logins.


From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Ivor Paul
Sent: Wednesday, October 15, 2008 5:36 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] login from token

Hi

I have users sending messages to other users with links in the email.

If the users click on the links in the email they go to the message in the app, 
but invariably they arent logged in and have to do so before getting to the 
page they want to go to.

I want to build a login_from_token functionality that would add a token for the 
user who receives the email so that the link will go directly to the page, and 
in the process log them in.

My question: How safe is this? Are their issues with this approach in terms of 
privacy?

The email is supposed to be personal email accounts so in principle the link 
would be as safe as the email account?

I would appreciate your thoughts.

Regards
Ivor



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ruby on rails tweaks

2008-10-15 Thread Freddy Andersen

Or install the thin gem and us that as the "development" server that
can start at boot time. Add a thin.yml in your codes config directory
so you can start the server with thin -C config/thin.yml start... You
can set the port number and stuff in the config file.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Array find vs. ActiveRecord find

2008-10-15 Thread Chris Drappier


> @page.parts.to_ary.find { |part| part.name = "some_name" }


this should be @page.parts.to_ary.find{|part| part.name == "some_name"}

the comparison operator is necessary for a find, if you use =, then you 
will set the attribute to the value.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



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

2008-10-15 Thread Roger Pack

> I'm trying to add multi admin/shop support to the application and, seen 
> the
> original database structure, it seems easier just to use one database 
> for
> each shop.

Also checkout http://tomayko.com/writings/rails-multiple-connections and 
Dr. nic's magic multi connections :)
-=R
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Inventory/warehouse management, order picking etc...

2008-10-15 Thread Ar Chron


> If there anyone out there with dev experience in this domain type..

I'm in a different domain but we face similar issues.

   Cusotmers, orders, line items, and products would be the bare bones 
I'd think to start bootstrapping an application.
   At the bottom of the application, there would be a products table 
with a record for each thing that you sell. Each of those products would 
have a physical "on-hand" count of inventory, an allocated count, and 
available (just on-hand - allocated). How you manage those numbers 
depends on how much you "game" your supply chain.
   When a customer places an order, the "allocated" number would 
increase by the units requested, available is just inventory - 
allocated. When the order is actually fulfilled (i.e., the item is 
physically picked and put in a box, or on a truck, or whatever), the 
allocated count drops by x units, and the inventory count drops by x 
units as well. On products, you'll probably want to set a lower 
threshold for on-hand inventory, to prompt an order from your supplier 
(sounds like an after_update filter in Rails).
   "Gaming" your supply chain involves scenarios like "We have 10 
widgets on hand today. Customer A, at 9:00am, ordered 7 for delivery 
next Wednesday. Physical inventory is still 10, available is only 3. 
Customer B, at noon, requests 5 for delivery tomorrow.
   If you don't game your supply chain, you tell Customer B "Sorry, I 
only have 3 available, but I can get you 5 in (today + time to receive 
widgets from supplier)."
   If you're sure (here's the gaming part) your supplier can get at 
least 2 more widgets to you before next Wednesday if you order today, go 
ahead and sell and ship the 5 to Customer B today, and place your order 
for widgets today.
   Walk-in purchases are just another form of Customer B.

The nice thing about Rails is that you can easily extend an application. 
Start small... take note of how your current physical processes work, 
model your physical artifacts (product information, an order form, a 
customers file) in the database, then hook up the behaviors in the 
application.
   Run the app in parallel with your current process to see if your 
application accurately reflects reality, tweak and tune and when your 
app does everything your need (or can make do with), drop the paper.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Small regular expression question

2008-10-15 Thread Pardee, Roy

Google's your friend here.  "validate url with regular expression".

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Joe Peck
Sent: Wednesday, October 15, 2008 7:45 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Small regular expression question


I'm looking to write a regular expression that will match valid URLs.
My problem is that it almost works, except it accepts URLs with / in the middle 
of them, suchs as:
http://www.ruby/rails.com

It looks (to me) like my regular expression should not match strings like that, 
but it does.  Here is the regular expression:

.match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).*$/ix)

How can I make it not accept URLs with / in the middle of them?
--
Posted via http://www.ruby-forum.com/.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ruby on rails tweaks

2008-10-15 Thread Christian Johansen

Delirium tremens wrote:
> Is there a way to avoid having to type "ruby script/server" in "C:\www
> \myrubysite\"?

You mean you want the server to start when windows starts? Just make a 
file start_app.bat like this:

c:
cd \www\myrubysite
ruby script\server

and place it in your system startup folder. Or, you can look at some 
sort of application as service thing: 
http://www.application-as-service.com/ (haven't tested it).

> 
> Is there a way to eliminate ":3000" from " http://localhost:3000/ "?

specify the server to run on port 80: ruby script/server -p 80. Try ruby 
script/server --help

> 
> Is there a way to add '"myrubysite" to " http://localhost/ "?

As a site prefix? IE http://localhost/myrubysite? Or as a host name? IE 
http://myrubysite/

The latter can be done through editing 
C:\Windows\System32\Drivers\Etc\Hosts and adding a line like

127.0.0.1 myrubysite

Then you can reach your app like http://myrubysite

If you were thinking about the context path I'm not sure. Used to be 
this was a real hassle, but I haven't checked in a while, so it might 
have been fixed/made easy.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: avoiding "ruby script/server" and eliminating ":3000"

2008-10-15 Thread Pardee, Roy

Create an alias like so in your .bash_profile or wherever:

  alias rss='ruby script/server --port:80'

HTH,

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Alejandro Mansilla
Sent: Wednesday, October 15, 2008 8:19 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: avoiding "ruby script/server" and eliminating ":3000"


2008/10/15 Delirium tremens <[EMAIL PROTECTED]>:
>
> Is there a way to avoid having to type ruby script/server to test my
> site?

U can use Phusion Passenger to run in development instead of Webrick or Mongrel.
Using the "RailsEnv" statement pointing to  development in the virtual host 
definition.

cheers



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Inventory/warehouse management, order picking etc...

2008-10-15 Thread Andrew Edwards

Hi,

**
This reply ended up exploding in size, sorry! It details the overall
methods I'm employing, maybe you might spot any paths you've taken or
even rejected.
**

Thanks for taking the time to reply.

Are any of your products promoted on the web, or do you deal on a more
personal basis with clients?


I think I'm getting in fuss about the actual audit trail of inventory
in terms of cradle to grave. I also need to track by delivery batch so
that I can maintain a FIFO when required. It is possible I'm
overcomplicating by trying to simplify things to a more abstract
concept. I started looking at tracking inventory around double entry
accounting principles.

I have models such as:

class InventoryAccount < ActiveRecord::Base
belongs_to :product
belongs_to :storage_location

has_many :inventory_account_entries
has_many :transactions, :through => :inventory_account_entries
end

class InventoryTransaction < ActiveRecord::Base
before_save :check_transaction_balances
has_many :inventory_account_entries

private:

def check_transaction_balances
# check the account entry amounts have balancing debits and 
credits
end
end

class InventoryAccountEntry < ActiveRecord::Base
belongs_to :inventory_account
belongs_to :inventory_transaction
end

However it becomes complicated as every possible class of product
inventory needs a separate account. For example Product1 would need
account records for:

Product1, Income Account
Product1, Error Account
Product1, At Location 1, Available, From PurchaseOrder1
Product1, At Location 1, Available, From PurchaseOrder2
Product1, At Location 1, Allocated, From PurchaseOrder1
Product1, At Location 1, Allocated, From PurchaseOrder2

That's 6 accounts just for one product, and each time a new batch
arrives it would also create account objects for each location it is
placed in. I was initially worried that this might make it massively
unmanageable after a while but I suppose it is just disk space.
Eventually every batch accounts would migrate towards a zero balance,
after which they never really need to be referenced unless to look up
previous stock movements. Does this sound logical?

I could almost visualise this working but am struggling to keep the
concept when you need to transfer stock to sales/despatch orders.

Roughly, my sales order processing and despatch models are structured
as follows:

class Customer < ActiveRecord::Base
has_many :sales_orders
has_many :despatch_orders
has_many :invoices
end

class SalesOrder < ActiveRecord::Base
belongs_to :customer
has_many :sales_order_lines
end

class DespatchOrder < ActiveRecord::Base
belongs_to :customer
has_many :despatch_order_lines
end

class Invoice < ActiveRecord::Base
belongs_to :customer
has_many :invoice_lines
end

class PickingBatch < ActiveRecord::Base
# picking trolley has fixed number of locations and decides the
maximum number of despatch orders per picking batch
belongs_to :picking_trolley

has_many :despatch_orders
has_many :despatch_order_lines, :through => :despatch_orders

def optimise_picking_order
# assign a sequence number to each despatch_order_line in such a
# way that lines from different despatch_orders are interleaved
during picking
# to achieve an optimal route around the warehouse
end
end

Inventory is allocated to the sales_order which then creates a
despatch order. The despatch order is picked and on pick completion
triggers payment collection at which point an invoice (receipt) is
generated. The picked despatch order then generates a despatch note
and is sent for packing before being barcode scanned to confirm
confirm packing and despatch.

I think the sticking point for me is how to integrate stock movements
using the above double entry method with my SOP models (sales_order,
despatch_order etc). In theory each despatch order (or despatch order
line) would need it own account so stock flowed between
inventory_account_entries from the product income account to the
eventual resting place on the despatch_order_line.

Or maybe I should take a completely different approach (read
simpler!), although I do like the elegance of the double entry
accounting model.


Thanks, Andrew.


On Oct 15, 12:22 pm, Andrew Edwards <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> Apologies if this isn't the best fit for this group.
>
> Does anyone know of any rails based warehouse management systems (I
> have looked, but with little result)? Including inventory tracking and
> order picking?
>
> I'm currently working on such a rails project for our small retail/
> wholesale business and am struggling to pin down the model
> (specifically inventory tracking, modeling transactions to represent
> movements between available, allocated, document shortages etc).
>
> I could real

[Rails] Re: Inventory/warehouse management, order picking etc...

2008-10-15 Thread Erik

Where can I see a demo of your app.? :)

On Oct 15, 8:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Andrew,
> I've developed a family of inventory related products but don't
> understand what you mean by 'order picking'. In my systems the user
> would transact items out of a location, thus decrementing the balance
> and building a transaction for each occurance.
> My application is designed to handle many distinct companies in an
> SaaS business model.
>
> On Oct 15, 5:22 am, Andrew Edwards <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
>
> > Apologies if this isn't the best fit for this group.
>
> > Does anyone know of any rails based warehouse management systems (I
> > have looked, but with little result)? Including inventory tracking and
> > order picking?
>
> > I'm currently working on such a rails project for our small retail/
> > wholesale business and am struggling to pin down the model
> > (specifically inventory tracking, modeling transactions to represent
> > movements between available, allocated, document shortages etc).
>
> > I could really do with either researching a similar project or
> > speaking to some involved in a similar project.
>
> > If there anyone out there with dev experience in this domain type and
> > who wouldn't mind a short chat drop me a line.
>
> > 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: BOM Component

2008-10-15 Thread Erik

Did you ever get a reply? I'm curious to see what you come up with.


On Sep 23, 3:18 pm, Justin <[EMAIL PROTECTED]> wrote:
> I've been using an excel spreadsheet to track our component bill of
> materials and would like to migrate to a more robust system.  Does
> anyone know of a Bill of Material component that supports multiple
> parent / child relationships, costing, etc? I've done a lot of looking
> on Google and nothing has come up.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem with new action

2008-10-15 Thread Christian Johansen

Try running "rake routes" to see if the URL you get is recognized as a
resource url. Maybe the :controller/:action/:id route outranks your
resources route. The resources route should be specified higher up in
the file.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ruby on rails tweaks

2008-10-15 Thread Delirium tremens

Is there a way to avoid having to type "ruby script/server" in "C:\www
\myrubysite\"?

Is there a way to eliminate ":3000" from " http://localhost:3000/ "?

Is there a way to add '"myrubysite" to " http://localhost/ "?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] hi

2008-10-15 Thread best dede
I am new member. Please advice. Thx

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: avoiding "ruby script/server" and eliminating ":3000"

2008-10-15 Thread Alejandro Mansilla

2008/10/15 Delirium tremens <[EMAIL PROTECTED]>:
>
> Is there a way to avoid having to type ruby script/server to test my
> site?

U can use Phusion Passenger to run in development instead of Webrick or Mongrel.
Using the "RailsEnv" statement pointing to  development in the virtual
host definition.

cheers

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: to_json of hash containing an array

2008-10-15 Thread Vlajbert

This is also a problem in Merb. I believe AR's json and Merb's json
don't play well together. I put this in init.rb and now life is grand.

Merb.disable :json


On Aug 24, 1:04 pm, Mads Kristiansen <[EMAIL PROTECTED]>
wrote:
> Okay, thanks. Just wanted to confirm that it actually worked  
> somewhere.. :)
>
> I removed the "json_pure" gem and now it works for me too.. Not sure  
> if that will cause other problems, but we'll see about that.
>
> Best regards, Mads Kristiansen
>
> On 24/08/2008, at 19.32, Frederick Cheung wrote:
>
>
>
>
>
> > On 24 Aug 2008, at 13:41, Mads Kristiansen wrote:
>
> >> Hi there,
>
> >> I am fairly new to the Rails framework, so forgive me if there is an
> >> obvious solution to this problem.
>
> >> I am using Rails 2.1.0 and trying to jsonify a hash containing an
> >> array. E.g.
>
> >> result = { :name => "McLovin", :attachments => ['file.pdf',
> >> 'file.jpg'] }
> >> => {:attachments=>["file.pdf", "file.jpg"], :name=>"McLovin"}
> >> result.to_json
>
> >> I would expect something like:
>
> >> {
> >>  "name": "McLovin",
> >>  "attachments": [
> >>      "file.pdf",
> >>      "file.jpg"
> >>  ]
> >> }
> > Which is exactly what I got when I tried this out. Do you have any  
> > plugins/use any gems that could be clashing with activesupport's  
> > JSON stuff?
>
> > Fred
>
> >> But instead I get:
>
> >> TypeError: wrong argument type Hash (expected Data)
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoding.rb:21:in `to_json'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoding.rb:21:in `send'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoding.rb:21:in `encode'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoding.rb:31:in `raise_on_circular_reference'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoding.rb:20:in `encode'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoders/hash.rb:42:in `to_json'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoders/hash.rb:41:in `map'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoders/hash.rb:41:in `to_json'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/core_ext/object/misc.rb:28:in `returning'
> >>        from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
> >> active_support/json/encoders/hash.rb:40:in `to_json'
> >>        from (irb):54
>
> >> If I do "result.to_json( :except => :attachments )", then it works.
>
> >> Best regards, Mads Kristiansen

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] avoiding "ruby script/server" and eliminating ":3000"

2008-10-15 Thread Delirium tremens

Is there a way to avoid having to type ruby script/server to test my
site?

Is there a way to eliminate :3000 from http://localhost:3000/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Inventory/warehouse management, order picking etc...

2008-10-15 Thread [EMAIL PROTECTED]

Andrew,
I've developed a family of inventory related products but don't
understand what you mean by 'order picking'. In my systems the user
would transact items out of a location, thus decrementing the balance
and building a transaction for each occurance.
My application is designed to handle many distinct companies in an
SaaS business model.

On Oct 15, 5:22 am, Andrew Edwards <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> Apologies if this isn't the best fit for this group.
>
> Does anyone know of any rails based warehouse management systems (I
> have looked, but with little result)? Including inventory tracking and
> order picking?
>
> I'm currently working on such a rails project for our small retail/
> wholesale business and am struggling to pin down the model
> (specifically inventory tracking, modeling transactions to represent
> movements between available, allocated, document shortages etc).
>
> I could really do with either researching a similar project or
> speaking to some involved in a similar project.
>
> If there anyone out there with dev experience in this domain type and
> who wouldn't mind a short chat drop me a line.
>
> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Small regular expression question

2008-10-15 Thread Joe Peck

I'm looking to write a regular expression that will match valid URLs.
My problem is that it almost works, except it accepts URLs with / in the
middle of them, suchs as:
http://www.ruby/rails.com

It looks (to me) like my regular expression should not match strings
like that, but it does.  Here is the regular expression:

.match(/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(\w+).*$/ix)

How can I make it not accept URLs with / in the middle of them?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Time Zone

2008-10-15 Thread Hassan Schroeder

On Tue, Oct 14, 2008 at 12:24 AM, Abhishek shukla <[EMAIL PROTECTED]> wrote:

> Still i am very confuse my requirement is like a user save there timezone,
> then whenever he logs in he should see the time as per wat he set in
> timezone currently it displaying my system timezone.
>
> So what excatly i'll need to do? Do i need to create a method in which i'll
> need to set the timezone?

If you store the timezone as part of the user model, displaying the
appropriate local time would just be:
  @user.tz.now

HTH,
-- 
Hassan Schroeder  [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Adding an id to form_tag

2008-10-15 Thread Schalk Neethling

Thanks Frederick.

Frederick Cheung wrote:
> 
> On 15 Oct 2008, at 12:56, Schalk Neethling wrote:
> 
>> Hi all,
>>
>> When using form_for it is easy to add an id to the form using  :html  
>> =>
>> {:id => 'someid'}
>>
>> However, how would one accomplish the same when using the form_tag ?
>>
> pretty much the same form_tag({ url options ... }, {:id => 'someid'})
> 
> Fred
>> Thank you in advance,
>> Schalk
>>
> 
> 
> > 
> 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using Rails purely as a RESTful web service (no or little HTML)

2008-10-15 Thread [EMAIL PROTECTED]

> I ask, because I'm not particularly fond of the rails RHTML, and feel
> I'd get a quicker result integrating a Rails webservice with a content
> management system.

I disagree but find the approach very interesting. What CMS are you
going to use? And how closely would you bind them? Would you use rails
for all db transactions, or just for specific business logic?

Would you maintain separate databases or adapt Rails to work with the
CMS db (possible, though to me that kind of thing always seems a
little kludgy) or the other way around?

I'm just curious. Feel free to tell me to go away if you want.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use a string as template for mail body

2008-10-15 Thread Christian Johansen

Christian Johansen wrote:
> John Barnette wrote:
>> On Tue, Oct 14, 2008 at 2:29 PM, Christian Johansen
>> <[EMAIL PROTECTED]> wrote:
>>> Yup, I'm very aware of the safety implications. Basically this will be
>>> available to people who have access to the code as well, but it makes
>>> this task a bit easier. I'll look up simpler parsing that'll just allow
>>> for looking up properties on a single object or something like that.
>> 
>> http://www.liquidmarkup.org
>> 
>> 
>> ~ j.
> 
> Thanks, this looks very interesting!

Played around with it a little bit, and man, this is perfect for what I 
needed. Very cool!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] login from token

2008-10-15 Thread Ivor Paul
Hi

I have users sending messages to other users with links in the email.

If the users click on the links in the email they go to the message in the
app, but invariably they arent logged in and have to do so before getting to
the page they want to go to.

I want to build a login_from_token functionality that would add a token for
the user who receives the email so that the link will go directly to the
page, and in the process log them in.

My question: How safe is this? Are their issues with this approach in terms
of privacy?

The email is supposed to be personal email accounts so in principle the link
would be as safe as the email account?

I would appreciate your thoughts.

Regards
Ivor

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] how to configure a server with new development environment

2008-10-15 Thread Sunny Bogawat

Hi,
 In my application i created a new environment  say sunny for
development purpose.
  currently i am start server using command
   ruby script/server -e sunny

 but i want to configure it in aptana(editor), but it not showing
environment as sunny
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Adding an id to form_tag

2008-10-15 Thread Frederick Cheung


On 15 Oct 2008, at 12:56, Schalk Neethling wrote:

>
> Hi all,
>
> When using form_for it is easy to add an id to the form using  :html  
> =>
> {:id => 'someid'}
>
> However, how would one accomplish the same when using the form_tag ?
>
pretty much the same form_tag({ url options ... }, {:id => 'someid'})

Fred
> Thank you in advance,
> Schalk
>
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] why do I get 1 as id for all locations??

2008-10-15 Thread Jay Pangmi

Hi, I'm trying to save all the details stored in the session in a table.
This session holds ids of records in the carts table but as it holds
just the name of location, I'm using for loop to try and find the id of
each location. Here's my implementation:

def find_cart
 session[:cart_ids] ||= []
end

To populate carts table:

def add_to_cart
 @cart=find_cart
 cart=Cart.create(:location => ..)
 @cart << cart.id
end

To save in the table:

def save_details
 @cart_items=Cart.find(session[:cart_ids])
 for item in @cart_items
  @camp_id=Campsite.find(:all, :select=>'id',
:conditions=>["camp_location = ?",item.location])
  Booking.create(:location_id=>@camp_id, .)
 end
end


But, surprisingly, I only get 1 saved under location_id under bookings
table no matter which location I select and of course each location has
different id in campsites table. Thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Adding an id to form_tag

2008-10-15 Thread Schalk Neethling

Hi all,

When using form_for it is easy to add an id to the form using  :html => 
{:id => 'someid'}

However, how would one accomplish the same when using the form_tag ?

Thank you in advance,
Schalk

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Inventory/warehouse management, order picking etc...

2008-10-15 Thread Andrew Edwards

Hi,

Apologies if this isn't the best fit for this group.

Does anyone know of any rails based warehouse management systems (I
have looked, but with little result)? Including inventory tracking and
order picking?

I'm currently working on such a rails project for our small retail/
wholesale business and am struggling to pin down the model
(specifically inventory tracking, modeling transactions to represent
movements between available, allocated, document shortages etc).

I could really do with either researching a similar project or
speaking to some involved in a similar project.

If there anyone out there with dev experience in this domain type and
who wouldn't mind a short chat drop me a line.

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



[Rails] Re: using ferret indexes

2008-10-15 Thread lyes

Hello!
Thank you for your response!



> You want to do anything else with those indexes? Tell us, what you
> want to do.
>
> But I would recommend using Sphinx instead of Ferret.
> People had quite some trouble with Ferret, everything working fine in
> development,

No! I can not use Sphinx because I already have write an index/serach
application using ferret in order to index some documents for my
company! What I want to do is to open the indexes I will create with
my application inside a ruby rails web application and I want to know
if I can load them using acts_as_ferret!

In all the acts_as_ferret tutorials, they show how we can create and
serach in indexes created with acts_as_ferret itself.
Is there a mean to create an index with acts_as_ferret in a ruby rails
web application using an already existing index created by ferret in
order to offer a web interface for the serach operation. You will
agree that offering a command line for a simple user to search is not
a ver goos idea



> http://www.sphinxsearch.com/http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/classes/Active...http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-...
PS: thank you for the links

Cheers
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: authenticity_token sent, still InvalidAuthenticityToken

2008-10-15 Thread Anjan Tek

Hi!

I think both of you have hit the nail on the head.

Just to avoid confusion, I placed all 3 of my methods in question into 
the same controller (one working method, one method that does not work 
and one method which renders the page that has the flex app in it).

Here is the log output when I load the rails app in my browser: (I've 
set map.root to execute the "index" method.
__

Processing QuestionsController#index (for 192.170.50.67 at 2008-10-15 
15:56:47) [GET]
  Session ID: 594b5d72d93b07f9d6a272f301a3e0f7
  Parameters: {"action"=>"index", "controller"=>"questions"}
Rendering questions/index
Completed in 0.00188 (531 reqs/sec) | Rendering: 0.00042 (22%) | DB: 
0.0 (0%) | 200 OK [http://192.170.50.67/]


Processing QuestionsController#index (for 192.170.50.67 at 2008-10-15 
15:56:47) [GET]
  Session ID: 
BAh7BzoMY3NyZl9pZCIlOTdiYWM0MDM0OGM0NmRmZDkzZWJiMDhhNzIwYjIy
ODQiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
c2h7AAY6CkB1c2VkewA=--1a32065d2fd99849429fc9dec4dcb26ec4e3623a
  Parameters: {"action"=>"index", "controller"=>"questions", 
"debug"=>"true"}
Rendering questions/index
Completed in 0.00193 (517 reqs/sec) | Rendering: 0.00045 (23%) | DB: 
0.0 (0%) | 200 OK [http://192.170.50.67/?debug=true]



I've got no idea why it executes the same method twice, but it looks 
like the second Session ID is what sticks.

Here is the log output when I call the "insert" method that works:

__

Processing QuestionsController#insert (for 192.170.50.67 at 2008-10-15 
15:58:24) [POST]
  Session ID: 
BAh7BzoMY3NyZl9pZCIlOTdiYWM0MDM0OGM0NmRmZDkzZWJiMDhhNzIwYjIy
ODQiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
c2h7AAY6CkB1c2VkewA=--1a32065d2fd99849429fc9dec4dcb26ec4e3623a
  Parameters: 
{"authenticity_token"=>"86b74406048a7f629bd560eab8de771a74c620be", 
"temp_Image_Location"=>"/images/temp", "images_To_Be_Published"=>"", 
"action"=>"insert", "uuid"=>"927EE8CA-C86B-DDEC-C444-000C98986267", 
"separator"=>"&&", "controller"=>"questions"}
Completed in 0.00565 (176 reqs/sec) | Rendering: 0.00018 (3%) | DB: 
0.0 (0%) | 200 OK [http://192.170.50.67/questions/insert]

__

Notice that the Session ID is the same as the "index" method call.


Here is the log output when I call the "upload_image" method that DOES 
NOT WORK:

__


Processing QuestionsController#upload_image (for 192.170.50.67 at 
2008-10-15 15:57:33) [POST]
  Session ID: 8e7a7ad93525bce8a253542d8812ea4a
  Parameters: {"Filename"=>"Spiked.gif", 
"temp_Image_Location"=>"/images/temp", 
"authenticity_token"=>"86b74406048a7f629bd560eab8de771a74c620be", 
"action"=>"upload_image", "Upload"=>"Submit Query", 
"controller"=>"questions", "random_File_Name"=>"1224066450419_711.gif", 
"Filedata"=>#}


ActionController::InvalidAuthenticityToken 
(ActionController::InvalidAuthenticityToken):

__

As both of you suspected, the Session ID is different just for this 
method call.
And hence the authenticity token that I send is invalid.

If I call the "insert" method again after the "upload_image" method has 
failed, the Session ID is correct again and it works.

But I don't understand why the Session ID is suddenly different for one 
particular method.

Any ideas?

Thanks for the help so far.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: conditional join selection with active record

2008-10-15 Thread Frederick Cheung


On 15 Oct 2008, at 10:41, inriz wrote:

>
> hello list,
>
> i'm searching for an implementation of the following sql statement:
>
> SELECT inserent.* FROM inserent
> join
> (select objpriv.maknr from objpriv
> where objpriv.bankkto like '593%' and objpriv.zahlart = 'B'
> group by objpriv.maknr) o on o.maknr = inserent.insnr
>
> ORDER BY
> inserent.AENDDATUM desc
>
> evidently, i solved my problem with
>
> @advertisers = Advertiser.paginate(   :select => "inserent.*", :order =>
> "inserent.AENDDATUM desc", :from => "inserent join (select
> objpriv.maknr from objpriv where objpriv.bankkto like '#{query}' and
> objpriv.zahlart = 'B' group by objpriv.maknr) o on o.maknr =
> inserent.insnr")
>
> but, the pagination is broken.
> i know i'm abusing the from parameter for my needs

Use the :joins parameter ?

Fred


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: using ferret indexes

2008-10-15 Thread Thorsten Müller

Question is a bit unclear, you want just to use Ferret for indexing?
Yes that's possible.

You want to do anything else with those indexes? Tell us, what you
want to do.

But I would recommend using Sphinx instead of Ferret.
People had quite some trouble with Ferret, everything working fine in
development,
but as soon as they went into production, the thing was troublesome to
get working
on the server and in several cases keywords where not added to the
index with
no obvious reason.
In our company we had worked on another companies project, kind of
image search
with tags. They had 150.000 images, of which 30.000 where missing in
the index.
Rebuilding the index was no help at all.
Switching to Sphinx solved the problem in no time at all.
Search this forum if you want to know more, there where quite some
discussions going
about this.

http://www.sphinxsearch.com/
http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/classes/ActiveRecord/Base.html
http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Server settings for BackgrounDRB?

2008-10-15 Thread Max Williams

Thanks Kumar (or should i call you Hemant?)

I do have the latest version from git and i tried just manually patching 
in your chunk of code.  But it didn't seem to make any difference.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: redirect does not show error_messages

2008-10-15 Thread Sijo Kg

Hi

Thanks for the reply.Why I used the redirect because I first used render 
But In the view I have some check boxes One of them like
<%= select( "problem", "problem_urgency_id", 
ProblemUrgency.find(:all).collect {|p| [ p.name, p.id ] },options 
={:prompt => "<< Select any >>"}) %>

So in the above if I use render(if error happens) what happens is 
that
<< Select any >> is not shown  and only the values from the 
problem_urgencies table are shown  That is why I used the redirect_to 
But it has this problem(Not problem actually)..Could you please suggest 
how I can solve this?

Thanks in advance
Sijo
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to let a user render a partial?

2008-10-15 Thread David Trasbo

David Trasbo wrote:

> ==
> def dropify(content)
>   s = StringScanner.new(content)
>   output = ""
>   previous_end = 0
>   while s.scan_until(/\{/)
> output << content[previous_end, s.pointer - previous_end - 1]
> partial =  s.scan(/\w+/)
> s.skip /\s+/
> arguments = {}
> while argument = s.scan(/\w+:\w+/)
>   name, value = argument.split(/:/)
>   arguments[name.to_sym] = value
>   s.skip /\s+/
> end
> s.skip_until /\}/
> previous_end = s.pointer
> output << render(:partial => "drops/#{partial}", :locals => 
> arguments)
>   end
>   output << content[s.pointer, content.length - s.pointer]
> end
> ==

Okay, I actually have a concern about this method. Right now it only 
accepts this kind of syntax:

{test foo:foo_bar}

Since spaces are not covered by \w+ this is not accepted:

{test foo:foo bar}

So I tried changing \w+ to .+ but of course that is never going to work. 
E.g. if I try to pass multiple arguments to the partial like this:

{test foo:foo bar bar:bar foo}

then only one argument will only be passed (foo) and it will have this 
value: "foo bar bar" because the .+ includes that.

But what about putting quotation marks around it?

".+"

Still the same problem. Now foo will just have this value: "“foo bar” 
bar". So, here is my question: How can I make this method accept 
multiple arguments without being limited to that the values have to 
match "\w+"?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActionView: render a layout not in app/views?

2008-10-15 Thread Matthew Rudy Jacobs

Andrew Bloom wrote:
> Quite often I'm tasked with doing something very similar. Check out my
> solution:
> 
> class ExperiencesController < ApplicationController
>   self.view_paths << File.join(RAILS_ROOT, "cms", "experiences")
> 
>   def show
> render :layout => "1/layout"
>   end
> end
> 
> requiring a folder structure like:
> RAILS_ROOT/
>   app/
>   cms/
> experiences/
>   1/
> layout.html.erb
>   config/
>   ...
> 
> Does that help?
> 
> On Oct 14, 4:25�pm, Matthew Rudy Jacobs <[EMAIL PROTECTED]

Hey thanks andrew,
that's the same thing I'm trying to achieve,
although the code as such won't quite work in Rails 2.1.1

it'll give you errors about "found a view path that is not in the right 
format"

the correct way is
  append_view_path(...)

and you pointed out my error

I was doing;
  append_view_path("public/sites")

while actually what is required;
  append_view_path(File.join(Rails.root, "public", "sites"))

works great, it seems.
Thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] conditional join selection with active record

2008-10-15 Thread inriz

hello list,

i'm searching for an implementation of the following sql statement:

SELECT inserent.* FROM inserent
join
(select objpriv.maknr from objpriv
where objpriv.bankkto like '593%' and objpriv.zahlart = 'B'
group by objpriv.maknr) o on o.maknr = inserent.insnr

ORDER BY
 inserent.AENDDATUM desc

evidently, i solved my problem with

@advertisers = Advertiser.paginate( :select => "inserent.*", :order =>
"inserent.AENDDATUM desc", :from => "inserent join (select
objpriv.maknr from objpriv where objpriv.bankkto like '#{query}' and
objpriv.zahlart = 'B' group by objpriv.maknr) o on o.maknr =
inserent.insnr")

but, the pagination is broken.
i know i'm abusing the from parameter for my needs

what's the way to implement it?

thanks for all your help

best regards
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] using ferret indexes

2008-10-15 Thread lyes

Hello list,
 I am newbe with ruby rails, and I want to now if is it possible de
access indexes created with Ferret using acts_as_ferret (I assume that
we can do that)

Links to some good tutorials will be welcome

thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Ruby and MySQL backup

2008-10-15 Thread Christian Johansen

I always use automysqlbackup 
(http://sourceforge.net/projects/automysqlbackup/). It's not ruby, but 
it's damn fine for backing up MySQL especially if you need to backup 
several databases on the same server.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Has and belongs to many, join table id included in query

2008-10-15 Thread Christian Johansen

Bill Kocik wrote:
> Not to pimp my blog or anything, but I wrote about this exact issue
> here: http://bkocik.net/2007/07/26/habtm-and-the-id-field/
> 
> That should help you understand what's going on (in a very long-winded
> manner). :)
> 
> On Oct 14, 6:26�pm, Christian Johansen <[EMAIL PROTECTED]

Ah, great stuff, thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to let a user render a partial?

2008-10-15 Thread David Trasbo

Frederick Cheung wrote:

>> Did your method work for you, or what?
> 
> yeah i left out that bit by accident. you should do that (ie output <<
> render(...)) after I set previous_end at the end of the loop

Okay, thanks!

>> What is "off by 1 errors"?
> 
> some of the offsets might be off by 1 (eg someplaces where it says
> pointer it might need to be s.pointer-1 etc..). More generally I just
> bashed that out in Mail so I expect that   there's the odd mistake
> like that in there.

All right, with my new knowledge I've changed your method a little bit 
and it works perfectly well.

So this is the new final version of the method:

==
def dropify(content)
  s = StringScanner.new(content)
  output = ""
  previous_end = 0
  while s.scan_until(/\{/)
output << content[previous_end, s.pointer - previous_end - 1]
partial =  s.scan(/\w+/)
s.skip /\s+/
arguments = {}
while argument = s.scan(/\w+:\w+/)
  name, value = argument.split(/:/)
  arguments[name.to_sym] = value
  s.skip /\s+/
end
s.skip_until /\}/
previous_end = s.pointer
output << render(:partial => "drops/#{partial}", :locals => 
arguments)
  end
  output << content[s.pointer, content.length - s.pointer]
end
==

Notice that in the 6th line i subtract s.pointer-previous_end by 1 and 
that's what made it work.

Thanks for your help, Fred!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: More than one check boxes and selecting all the check boxes

2008-10-15 Thread Indu RS

Bala kishore Pulicherla wrote:

> for user in params[:user_status]
>   puts user
> ###' should be able get the all the user ids that are selected
>   end
> 
> 
> hope it will help u.
> 
> :) Bala
> On Wed, Oct 15, 2008 at 1:18 PM, Indu RS
Thank you so much for the immediate response and solved my issue
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: active record validations by Eshwar

2008-10-15 Thread cool

then what can i use in the controller create method,
can u help me regarding this  plzz

On Oct 15, 1:13 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Oct 15, 8:28 am, cool <[EMAIL PROTECTED]> wrote:
> g like
>
>
> ate
>
>
> >  def create
> >   puts params[:external_link][:title].inspect
> >   params[:external_link][:title].each_with_index do |l, i|
> > ExternalLink.create!({:title => l, :url => params[:external_link]
> > [:url][i], :label => params[:label]})
> >   end
> >   redirect url(:external_links)
> >   end
>
> > in the model i have specified as
>
> > validates_presence_of :title, :url
>
> > the problem is when i submit the the form with out entering any
> > details its not checking validation
> > its giving error like
>
> > Validation failed: Title can't be blank, Url can't be blank
>
> If you use the ! variants of save, create, update_attributes etc...
> then validation failures raise an error instead of returning false.
>
> Fred
>
>
>
> > how can i do that in the controller and model
>
> > badly i need a help in this its urgent and imp.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Combine date and time in mysql

2008-10-15 Thread Pål Bergström

I have a date from a calendar_date_select and a time from a time_select.
They go to a date field and a time field in mysql. How do I combine time
and date on both sides to make a comparison in a find?

I think this is on the right path, right?

DATE_ADD(start_date, INTERVAL start_time HOUR_SECOND)
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: SSL With Ajax call

2008-10-15 Thread Frederick Cheung



On Oct 15, 7:22 am, "Abhishek shukla" <[EMAIL PROTECTED]> wrote:
> Hello Friends,
>
> In my application on signup page ssl in implemented which is working fine
> but my Ajax functionaility part is now stoped working  any idea to resolve
> this problem?
>
Are you trying to make an ajax call from an ssl page to a non ssl one
(or vice versa) ?

Fred
> regards
> Abhishek
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >