[Rails] Re: Calling Rake from INSIDE the application

2008-12-01 Thread Freddy Andersen

def run_task
  result = %x(rake #{params[:rake_task]})
end

If you don't want to hold the thread you can install the crontab gem
and install a new crontab with a ts:in or use background-fu and push
the job to the background...




--~--~-~--~~~---~--~~
You received 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: Can I export db data to fixtures?

2008-12-01 Thread Arthur Chan

Brian Hogan wrote:
> Yeah there are a few plugins to do that. There's one called
> ar_fixtures that should work just fine.  I don't know if it's
> supported any more but I know it still works fine.
> 
> On Mon, Dec 1, 2008 at 8:14 PM, Arthur Chan

Thanks Brian, it seems to be what I want. :)

-- 
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: Rails on shared hosting

2008-12-01 Thread Bobnation

I tried running a Rails app through cPanel a long time ago and gave up
because I like to have finer control over everything. If money is not
too much of an issue, I think you would be better served by signing up
for a VPS from somewhere and then setting up your own virtual server
to run the app on if for no other reason than to gain a good
understanding for how Rails applications are served to your audience.
--~--~-~--~~~---~--~~
You received 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 extend rails(add new function in lib)

2008-12-01 Thread hei

Can anyone help me ~~


On 12月2日, 下午12时04分, hei <[EMAIL PROTECTED]> wrote:
> I do things below:
>
> In lib/translater.rb
> class Translater
>  require "rubygems"
>  require "rmmseg"
>  include "RMMSeg"
>  ...
>  def segment(text)
>RMMSeg::segment(text)
>  end
> end
>
> in helper/xx/xxx.rb
> module xx
>   require "translater.rb"
>   def translate(text)
> Translater.run(text)
>   end
> end
>
> when i use helper method tranlate,  erros:
> undefined method `segment' for RMMSeg:Module
> But when I test these in a simple ruby program it works well
> Can anyone help me ?
--~--~-~--~~~---~--~~
You received 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] in place form editing

2008-12-01 Thread napster

Hi Guys,

  i need to implement in place form editing in my application
and i am not using scaffold here will u plz help me to solve this
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: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread balaji rajagopal
Hi..
   Good Morning

I enter the values are mahapalipuram , is equal to ID value is 2 but i
got value 1,and hide 2 values so i got Null,Null,www.mpm.com

I can't understand the error.So if any one help me.


Thanks
Balaji

 ActiveRecord::StatementInvalid in WizardController#wizard

Mysql::Error: #23000Column 'resorttypeid' cannot be null: INSERT INTO
`resort_basics` (`resortclassid`, `resortname`, `resorttypeid`,
`seasonid`, `website`) VALUES(1, 'mahapalipuram ', NULL, NULL,
'www.mpm.com')

RAILS_ROOT: D:/RubyProjects/TestEcohols
Application Trace  | Framework
Trace| Full
Trace 

D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in
`execute'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in
`insert_sql'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in
`insert_sql'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in
`insert'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in
`insert_with_query_dirty'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in
`create'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:226:in
`create_with_callbacks'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/timestamp.rb:29:in
`create_with_timestamps'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2238:in
`create_or_update'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:213:in
`create_or_update_with_callbacks'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in
`save'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in
`save_with_validation'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save_with_transactions'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in
`transaction'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in
`transaction'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save_with_transactions'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in
`rollback_active_record_state!'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
`save_with_transactions'
app/controllers/wizard_controller.rb:42:in `wizard'
:1:in `start'

D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in
`execute'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in
`insert_sql'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in
`insert_sql'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in
`insert'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in
`insert_with_query_dirty'
D:/Program Files/NetBeans
6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activ

[Rails] Re: Rails on shared hosting

2008-12-01 Thread James Englert
Rails would need to be installed.  Do you have an .htaccess file that
resides in your public_html directory?  If so, that file is crucial for
getting your app up and running.

On Mon, Dec 1, 2008 at 7:46 PM, Nellboy <[EMAIL PROTECTED]> wrote:

>
> As far as I know (and that's not much in this case), then Rails needs
> to be installed by the hosting provider... and i'd say your chances of
> making that happen are somewhere between nil and none... Maybe there's
> some workaround to this, I know that phusion passenger allows
> deployment to Apache webservers, but I haven't used it, so I don't
> know about this case (although any day now i'm gonna investigate
> it)... maybe there's another solution anyone??
>
> On Dec 1, 11:08 pm, "Joshua Partogi" <[EMAIL PROTECTED]> wrote:
> > Dear all,
> >
> > Has anyone run RoR on cPanel based shared hosting? I've got my RoR
> > application onhttp://mydomain:10024/
> >
> > Now I've uploaded all my Product model, view and controller.
> >
> > Then I tried hitting:http://mydomain:10024/productsbut it didn't work
> >
> > Is there any configuration I need to do on a shared hosting? Has
> > anyone experience with this before?
> >
> > I'm sorry I have to ask it here since the hosting provided weren't
> > very supportive as they said it's the problem with the apps, but this
> > seems to be a relatively simple question :-(
> >
> > Thank you in advance for the support.
> >
> > --
> > Not by might nor by power, but by His Spirit.
> >
> > Read my blog:http://joshuajava.wordpress.com/
> > Follow me on twitter:http://twitter.com/jpartogi
> >
>

--~--~-~--~~~---~--~~
You received 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: valid? is not working in Rails 2.2.2

2008-12-01 Thread Bobnation

Glad to hear that it was cleared up.

On Dec 1, 10:57 pm, Vipin Vm <[EMAIL PROTECTED]> wrote:
> Hi guys...
>
> First of all Sorry ... :( . i had a plugin called gloc-1.1.0 in my
> vender/plugin. That was causing the problem.
>
> Thanks guys,
> Vipin
> --
> 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: valid? is not working in Rails 2.2.2

2008-12-01 Thread Vipin Vm

Hi guys...

First of all Sorry ... :( . i had a plugin called gloc-1.1.0 in my 
vender/plugin. That was causing the problem.

Thanks guys,
Vipin
-- 
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: aasm callback order?

2008-12-01 Thread Dan Sharp

Dusty,

That may very well be it. I thought it was a longer list, but maybe
I'm just remembering the two lists (new vs. existing) and somehow
lumping them together.

Thanks for the reference, though! :-)

-Danimal

On Mon, Dec 1, 2008 at 12:26 PM, dusty <[EMAIL PROTECTED]> wrote:
>
> Is this it?
>
> http://didcoe.id.au/archives/finite-state-machines-in-rails
>
> On Oct 27, 7:55 pm, Danimal <[EMAIL PROTECTED]> wrote:
>> Thank you, Robert! I'll have to try out foxmarks. I suspect that the
>> problem was PEBKAC... i.e. I probably thought "that's a cool page, I
>> should bookmark it" and for whatever reason did not. Heh.
>>
>> Anyway... anyone else have an inkling about the page/wiki that I'm
>> talking about? Or was it just in a dream?
>>
>> :-)
>>
>> -Danimal
>>
>> On Oct 27, 6:52 pm, Robert Zotter <[EMAIL PROTECTED]> wrote:
>>
>> > Ahhh I see. Sorry, Im not familiar with that wiki you are talking
>> > about. However I can solve your bookmarking problem if you happen to
>> > use Firefoxhttp://www.foxmarks.com/ :)
>>
>> > Good luck finding that wiki.
>> > --
>> > Robert Zotter
>> > Zapient, LLC
>> > Ruby on Rails Development and Consulting
>>
>> >http://www.zapient.comhttp://www.fromjavatoruby.com
>>
>> > On Oct 27, 5:48 pm, Danimal <[EMAIL PROTECTED]> wrote:
>>
>> > > Robert,
>>
>> > > I appreciate the fast response. Actually, though, there was a page
>> > > somewhere that showed the FULL lifecycle of a ruby model that goes
>> > > through before_save, validation, after_save, and all that along with
>> > > the AASM transitions when the bang (!) character is included and when
>> > > enters, exits, guards, transitions and such are used.
>>
>> > > I can practically visualize the page I remember... it was a listing of
>> > > the order of each of these "steps" (callbacks and such).
>>
>> > > In other words, it was very similar to the first part of 
>> > > this:http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
>> > > but with the AASM hooks included.
>>
>> > > It's just bugging me because I thought I bookmarked the page and I
>> > > can't find my bookmark. *sigh*
>>
>> > > -Danimal
>>
>> > > On Oct 27, 6:42 pm, Robert Zotter <[EMAIL PROTECTED]> wrote:
>>
>> > > > Danimal,
>>
>> > > > Usually the best place to look is the actual source 
>> > > > itself.http://github.com/omghax/acts_as_state_machine/tree/master/lib/acts_a...
>>
>> > > > Looks like this is what you are looking for
>> > > > :entering
>> > > > :entered
>> > > > :exited
>>
>> > > > The entering and exiting methods call the @enter and @exit options
>> > > > respectively which are passed in during instantiation.
>>
>> > > > Cheers
>>
>> > > > --
>> > > > Robert Zotter
>> > > > Zapient, LLC
>> > > > Ruby on Rails Development and Consulting
>>
>> > > >http://www.zapient.comhttp://www.fromjavatoruby.com
>>
>> > > > On Oct 27, 5:31 pm, Danimal <[EMAIL PROTECTED]> wrote:
>>
>> > > > > Hello!
>>
>> > > > > Sometime ago I ran across a webpage where someone had identified the
>> > > > > full callback sequence for an object lifecycle including AASM with
>> > > > > it's :enter and :exit and whatnot callbacks. Unfortunately, I can't
>> > > > > find it and searches don't seem to help.
>>
>> > > > > Does anyone have a reference to a page that shows the callback
>> > > > > sequence with Acts As State Machine (the gem)?
>>
>> > > > > I think there was a Wiki page on github with this, but I can't find
>> > > > > it. Grrr.
>>
>> > > > > Thanks!
>>
>> > > > > -Danimal
> >
>

--~--~-~--~~~---~--~~
You received 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: valid? is not working in Rails 2.2.2

2008-12-01 Thread Vipin Vm

Hi All,

My project was started in 1.2.6 then i upgraded to 2.0.2. Last week i 
updated it into 2.2.2. Then i got this problem. Then i again moved it 
back to 2.0.2 and it worked fine. These are the changes i have made in 
my config files.

in env.rb :-
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
config.time_zone = 'UTC'
config.threadsafe!

database.yml:-
pool: 10
wait_timeout: 10

when i upgraded to 2.2.2, got a new file called new_rails_defaults.rb in 
initializers folder.

I created a new project in 2.2.2 and connected to my original db. its 
also working fine.
-- 
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: just installed acts_as_state_machine and now cant launch the server

2008-12-01 Thread lunaclaire

never mind... I installed the plugin and in the process got the
previously tagged versions... once I removed them, it all worked fine

On Dec 1, 7:34 pm, lunaclaire <[EMAIL PROTECTED]> wrote:
> I just installed AASM and when I run 'ruby script/server' it fails
> with:
>
> => Booting Mongrel (use 'script/server webrick' to force WEBrick)
> => Rails application starting onhttp://0.0.0.0:3000
> => Call with -d to detach
> => Ctrl-C to shutdown server
> ** Starting Mongrel listening at 0.0.0.0:3000
> ** Starting Rails with development environment...
> Exiting
> C:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
> active_support/dependencies.rb:477:in `const_missing': uninitialized
> constant Rails::Initializer::ScottBarron (NameError)
>
> the plugin is installed in the vendor/plugins
>
> I can see the code that declares the modules, so it seems like all
> should be cool. I must be missing something... any ideas?
>
> 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] Problem with extend rails(add new function in lib)

2008-12-01 Thread hei

I do things below:

In lib/translater.rb
class Translater
 require "rubygems"
 require "rmmseg"
 include "RMMSeg"
 ...
 def segment(text)
   RMMSeg::segment(text)
 end
end

in helper/xx/xxx.rb
module xx
  require "translater.rb"
  def translate(text)
Translater.run(text)
  end
end

when i use helper method tranlate,  erros:
undefined method `segment' for RMMSeg:Module
But when I test these in a simple ruby program it works well
Can anyone help me ?
--~--~-~--~~~---~--~~
You received 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] just installed acts_as_state_machine and now cant launch the server

2008-12-01 Thread lunaclaire

I just installed AASM and when I run 'ruby script/server' it fails
with:

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
C:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_support/dependencies.rb:477:in `const_missing': uninitialized
constant Rails::Initializer::ScottBarron (NameError)

the plugin is installed in the vendor/plugins

I can see the code that declares the modules, so it seems like all
should be cool. I must be missing something... any ideas?

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: Can I export db data to fixtures?

2008-12-01 Thread Brian Hogan

Yeah there are a few plugins to do that. There's one called
ar_fixtures that should work just fine.  I don't know if it's
supported any more but I know it still works fine.

On Mon, Dec 1, 2008 at 8:14 PM, Arthur Chan
<[EMAIL PROTECTED]> wrote:
>
> Hi Guys,
>
> Is there any way to export db data to fixtures files?
>
> (like the reverse of  "rake db:fixtures:load")
>
> Thanks,
> Arthur
> --
> 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] Calling Rake from INSIDE the application

2008-12-01 Thread Dante Regis
Hey there
I would like to know if I can call a rake task from inside my Rails App.
Something like

class MyModel < ActiveRecord::Base
  after_save :run_task

  def run_task
Rake.run("my:little:task")
  end
end

This is the deal: I use thinking-sphinx and need to update a bunch of data
through Model.update_all. But I would like sphinx to index it just after I'm
done, by running rake ts:index.

Is that possible?

Thanks,
Dante

--~--~-~--~~~---~--~~
You received 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] ActionMailer, unit testing and multipart mails

2008-12-01 Thread Trejkaz

Hi all.

Is there a "correct" way of writing a unit test for a mailer which
sends attachments?

I tried using the @expected variable as provided in
ActionMailer::TestCase, but it led to various problems.

Here's what I'm attempting...

  def test_notification
@expected.from = ''
@expected.to   = ''
@expected.subject  = ''
@expected.content_type = 'multipart/mixed; boundary="something"'

body_part = TMail::Mail.new
body_part.content_type = 'text/plain'
body_part.body = read_fixture('notification')
@expected.parts << body_part  # <=== ERROR HERE

attach_part = TMail::Mail.new
attach_part.content_type = 'application/octet-stream'
attach_part.encoding = 'base64'
attach_part.body = 'abc'
@expected.parts << attach_part

mail = Notifier.create_notification()

assert_equal @expected.encoded, mail.encoded
  end

This gives the following error:

TypeError: can't convert nil into String
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/action_mailer/
vendor/tmail-1.2.3/tmail/mail.rb:551:in `quote'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/mail.rb:551:in `read_multipart'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/mail.rb:540:in `parse_body_0'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/mail.rb:526:in `parse_body'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/stringio.rb:43:in `open'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/port.rb:340:in `ropen'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/mail.rb:524:in `parse_body'
C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.2/lib/
action_mailer/vendor/tmail-1.2.3/tmail/mail.rb:497:in `parts'
C:/Projects/portal/trunk/test/unit/notifier_test.rb:16:in
`test_notification'

Line 16 is commented in the above code.  Looking at mail.rb:551
suggests that body is nil, and I can confirm that the body passed in
was not nil.

I know I can just not use @expected and check each bit of the mail
separately, but I figure @expected is there for a reason (and also,
checking each bit of the mail only verifies what is supposed to be
there, not what isn't.)

Maybe I'm just doing things completely wrong, as I'm not 100% used to
Rails 2.x yet.

TX

--~--~-~--~~~---~--~~
You received 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] Can I export db data to fixtures?

2008-12-01 Thread Arthur Chan

Hi Guys,

Is there any way to export db data to fixtures files?

(like the reverse of  "rake db:fixtures:load")

Thanks,
Arthur
-- 
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] form_for with partial using do |@f|

2008-12-01 Thread Richard Schneeman


Is it possible to pass this FormBuilder object to a controller and then
back to a partial?


I have a form rendering a partial that i would like to update with a
call to my controller based on user selectable parameters, but when the
AJAX comes back, i get this error message because i cannot pass a form
builder object between the controller and the view:

"undefined method `text_area' for
"#":String"


My View looks like this:

<% form_for @phrase, :action => 'foo' do  |@f| -%>

 <%= select_tag(:language,
options_for_select(["Chinese","English"],
  :onchange=> remote_function(:with =>
  "'language='+this.value",
  :update => 'slang_form_partial',
  :url => {:action => :something,  :form => @f}
)) %>

 <%= render :partial => 'forms/slang_form_partial'%>

<%= @f.submit %>



In my controller i have something that looks like this:

  def something
  @default_language = params[:language]
  @f = params[:form]
  render :partial => 'forms/slang_form_partial'
end





Is it possible to pass this FormBuilder object to a controller and then
back to a partial? Rails 2.1.0 and Ruby 1.8.6.
-- 
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] Non-Profit Start up

2008-12-01 Thread Marvin Arnold

Hi,
My name is Marvin Arnold. I am a junior at MIT in EECS. I am starting a
non-profit, uService, with the mission of getting more college students
volunteering.

Although uService is a non profit, it has a unique and scalable business
model, that promises much future success. We are looking for a few
developers to join our team. If you are interested in learning more
about the organization (or have suggestions on better places to post)
please send an email to maarnold [at] mit [dot] edu.

Thanks,


---
Marvin Arnold
Massachusetts Institute of Technology
Department of Computer Science and Electrical Engineering
Class of MMX
-- 
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: rake test:units failing.

2008-12-01 Thread Rob Biedenharn

On Dec 1, 2008, at 7:52 PM, Maulin Pathare wrote:

>
> I figured it out, and it was dumb!
> I had commented out the test database settings from the database.yaml
> file. uncommenting them fixed the problem :)
>

the dumb ones hurt the most ;-)

-Rob

Rob Biedenharn  http://agileconsultingllc.com
[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] Optional parameter in nested routes

2008-12-01 Thread Constantin Gavrilescu

All my charges belong to a company. On the new charge form, sometimes I
specify a company, sometimes I don't because I don't know the company
beforehand in all cases.

So, sometimes the @company object is nil.
I'm using this helper: new_company_charge_path(@company)
For a company object, it generates a path like
/companies//32/charges/new
For a nil object, it generates a path like /companies//charges/new, but
I get an routing error (No route matches...).

I don't want to use an if in my view to use either new_charge_path or
new_company_charge_path. I reckon that /companies//charges/new can be
parseable and rails can recognize the path. Any ideas?

map.resources :charges
map.resources :companies do |company|
company.resources :charges
end
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Rails on shared hosting

2008-12-01 Thread Nellboy

As far as I know (and that's not much in this case), then Rails needs
to be installed by the hosting provider... and i'd say your chances of
making that happen are somewhere between nil and none... Maybe there's
some workaround to this, I know that phusion passenger allows
deployment to Apache webservers, but I haven't used it, so I don't
know about this case (although any day now i'm gonna investigate
it)... maybe there's another solution anyone??

On Dec 1, 11:08 pm, "Joshua Partogi" <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> Has anyone run RoR on cPanel based shared hosting? I've got my RoR
> application onhttp://mydomain:10024/
>
> Now I've uploaded all my Product model, view and controller.
>
> Then I tried hitting:http://mydomain:10024/productsbut it didn't work
>
> Is there any configuration I need to do on a shared hosting? Has
> anyone experience with this before?
>
> I'm sorry I have to ask it here since the hosting provided weren't
> very supportive as they said it's the problem with the apps, but this
> seems to be a relatively simple question :-(
>
> Thank you in advance for the support.
>
> --
> Not by might nor by power, but by His Spirit.
>
> Read my blog:http://joshuajava.wordpress.com/
> Follow me on twitter:http://twitter.com/jpartogi
--~--~-~--~~~---~--~~
You received 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: rake test:units failing.

2008-12-01 Thread Maulin Pathare

I figured it out, and it was dumb!
I had commented out the test database settings from the database.yaml
file. uncommenting them fixed the problem :)

-- 
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: New to Rails... Help!

2008-12-01 Thread Jay Mark

William, thanks for your help in resolving this issue.
It works great now. Thanks a lot.

Please, if you know any good book or online material
on Ruby/InstantRails 2.0.2, please post it in the Forum.
Thanks
Cypray










wfisk wrote:
> class Country
>   
> 
>   def people_tribes
> peoples.map{|p|p.tribe}.join(',')
>   end
> end

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

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



[Rails] Re: rake test:units failing.

2008-12-01 Thread Maulin Pathare

Hey Rob,
That was a typo on my part. My code actually has l.errors.on(:name).
Heres the pastebin link to the code
http://pastebin.com/m7cae6ae3

Rob Biedenharn wrote:
> I think you mean to have:
> 
>   l.errors.on(:name)
> Note: 'errors', not 'error'
> 
> -Rob
> 
> On Dec 1, 2008, at 7:05 PM, Maulin Pathare wrote:
> 
 The error occurred while evaluating nil.[]
>>> Otherwise the error object associated to the model will not have been
>> same error.
>>
>> When I run the command with the --trace command, I can see that rake
>> fails right after the execute db:test:purge step. I have included the
>> trace.
> 
> Rob Biedenharnhttp://agileconsultingllc.com
> [EMAIL PROTECTED]
> +1 513-295-4739
> Skype:  rob.biedenharn


Attachments:
http://www.ruby-forum.com/attachment/2996/ladder.rb

-- 
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: rake test:units failing.

2008-12-01 Thread Rob Biedenharn

I think you mean to have:

l.errors.on(:name)
Note: 'errors', not 'error'

-Rob

On Dec 1, 2008, at 7:05 PM, Maulin Pathare wrote:

>
> Rob Biedenharn wrote:
>> On Dec 1, 2008, at 2:14 PM, Maulin Pathare wrote:
>>>
>>>
>>> When I run rake test:units from the shell I get the following error
>>>
>>> rake aborted!
>>> You have a nil object when you didn't expect it!
>>> You might have expected an instance of ActiveRecord::Base.
>>> The error occurred while evaluating nil.[]
>>>
>>> I am running rails version 2.2.2
>>>
>>> Does anyone know whats wrong? Thanks.
>>
>>
>> Perhaps you need a line between 6 & 7 with:
>>
>>assert !l.valid?
>>
>> Otherwise the error object associated to the model will not have been
>> created.
>>
>> -Rob
>>
>> Rob Biedenharnhttp://agileconsultingllc.com
>> [EMAIL PROTECTED]
>
> Hey,
> Thanks for the reply. The assert !l.valid? did not help. I still get  
> the
> same error.
>
> When I run the command with the --trace command, I can see that rake
> fails right after the execute db:test:purge step. I have included the
> trace.

Rob Biedenharn  http://agileconsultingllc.com
[EMAIL PROTECTED]
+1 513-295-4739
Skype:  rob.biedenharn



--~--~-~--~~~---~--~~
You received 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: The verdict on Rails scaffolding

2008-12-01 Thread Davo

Thanks David - great article - most illuminating...
Dave


On Dec 1, 5:38 am, "David A. Black" <[EMAIL PROTECTED]> wrote:
> Hi --
>
> On Sun, 30 Nov 2008, Nellboy wrote:
>
> > Agreed, nice post there... The only thing i'd add to that, is that as
> > a Rails beginner-becoming-intermediate, I actually really like the
> > fact that you can get something up relatively quickly and then start
> > hacking away at it to create an app... I'd also add that unless you
> > really understand what's happening in terms of REST, etc. then it's
> > near impossible to effectively build a respectable app... I've had a
> > few moments of frustration/disappointment since I've created my first
> > scaffold, but as long as you stay the course, and have some
> > programming knowledge, it all makes perfect sense eventually...
>
> You might find this interesting -- it's a kind of explanatory
> scaffold, so to speak, for REST in Rails:
>
> http://dablog.rubypal.com/2008/11/24/restful-rails-for-the-restless
>
> (Or you might be past the point where it's useful, but I thought I'd
> throw it out there just in case.)
>
> David
>
> --
> Rails training from David A. Black and Ruby Power and Light:
> INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL
> Seehttp://www.rubypal.comfor details
> Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)
--~--~-~--~~~---~--~~
You received 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: rake test:units failing.

2008-12-01 Thread Maulin Pathare

Rob Biedenharn wrote:
> On Dec 1, 2008, at 2:14 PM, Maulin Pathare wrote:
>>
>>
>> When I run rake test:units from the shell I get the following error
>>
>> rake aborted!
>> You have a nil object when you didn't expect it!
>> You might have expected an instance of ActiveRecord::Base.
>> The error occurred while evaluating nil.[]
>>
>> I am running rails version 2.2.2
>>
>> Does anyone know whats wrong? Thanks.
> 
> 
> Perhaps you need a line between 6 & 7 with:
> 
> assert !l.valid?
> 
> Otherwise the error object associated to the model will not have been
> created.
> 
> -Rob
> 
> Rob Biedenharnhttp://agileconsultingllc.com
> [EMAIL PROTECTED]

Hey,
Thanks for the reply. The assert !l.valid? did not help. I still get the 
same error.

When I run the command with the --trace command, I can see that rake 
fails right after the execute db:test:purge step. I have included the 
trace.

** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:341
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in 
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in 
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:588:in 
`invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in 
`invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:577:in 
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in 
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:372
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in 
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in 
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:588:in 
`invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in 
`invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:577:in 
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in 
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in 
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in 
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
-- 
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: Views and bindings

2008-12-01 Thread Joe Blow

Frederick Cheung wrote:
> On Dec 1, 8:02�pm, Joe Blow <[EMAIL PROTECTED]> wrote:
>>
>> scope of the my_cool_block block? And even better yet, how could I get
>> the some_helper_method only to work when it is nested inside a
>> my_cool_block block?
> 
> Well you could probably do it by messing around with bindings and eval
> but that sounds like a sucky design. why not do something similar to
> form_for, ie your my_cool_block method yields an object encapsulating
> the state you want to share in its instance variables. usage could be
> 
> <% my_cool_block(5) do |helper| %>
>   <%= helper.some_helper_method "My var %>
> <% end %>
> 
> you could do other stuff too, eg call helper.with_value(5) and for the
> block passed to with_value, my_var would have value 5
> 
> Fred

Sorry for my ignorance but could you explain how would you do that. How 
would you yield and concat? A quick example would be worth a 1000 words 
:)
-- 
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: strange rails error on ubuntu 8.10

2008-12-01 Thread Jeff

On Dec 1, 12:08 am, Jeff <[EMAIL PROTECTED]> wrote:
> On Nov 30, 11:26 pm, Jeff <[EMAIL PROTECTED]> wrote:
>
> > Just upgraded from 8.04 to 8.10, which bumped my Ruby version to
> > 1.8.7, and my Rails app (frozen to 2.2.2) gets a strange error on
> > startup.  I can easily reproduce just by running script/about:
>
> > $ script/about
> > /vendor/rails/actionpack/lib/action_view/template_handler.rb:11:in
> > `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>
> > Anyone else having trouble with Rails on Ubuntu 8.10 and/or Rails
> > 1.8.7?
>
> > Jeff
>
> This has something to do with all the eager loading of the views.
> After removing a few views trying to narrow down the problem, script/
> about now gives this:
>
> ../activesupport/lib/active_support/dependencies.rb:275:in
> `load_missing_constant': uninitialized constant Rails::Info
> (NameError)
>

Perhaps another clue, maybe this will ring a bell for someone.  I'm
now slowly removing all of my views, running script/about after I
remove each one, and now I got this error:

$ script/about
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- rails/info
(MissingSourceFile)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from /home/jcohen/sites/pw/releases/20081201224923/vendor/rails/
activesupport/lib/active_support/dependencies.rb:155:in `require'
from /home/jcohen/sites/pw/releases/20081201224923/vendor/rails/
railties/lib/commands/about.rb:2
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from script/about:3

I can start script/console, and checking $LOAD_PATH reveals a few
differences from what's on my Mac OS X.  Here's what I get on my Mac,
for example:
>> $LOAD_PATH.select { |p| p =~ /railties/ }
=> ["/Users/jcohen/dev/pw/config/../vendor/rails/railties/lib/../
builtin/rails_info/", "/Users/jcohen/dev/pw/vendor/rails/railties", "/
Users/jcohen/dev/pw/vendor/rails/railties/lib", "/Users/jcohen/dev/pw/
config/../vendor/rails/railties/lib"]

Notice that first path to builtin/rails_info.  Doing the same on my
Ubuntu/Ruby 1.8.7 box shows this:

>> $LOAD_PATH.select { |p| p =~ /railties/ }
=> ["/home/jcohen/sites/pw/releases/20081201224923/vendor/rails/
railties", "/home/jcohen/sites/pw/releases/20081201224923/vendor/rails/
railties/lib", "/home/jcohen/sites/pw/releases/20081201224923/
config/../vendor/rails/railties/lib"]

In other words, the path to railsties/lib../builtin/rails_info is not
there!  And if the load path is messed up, then I bet other things are
also.

I've tried unfreezing rails and using 2.2.2 gems, with the same result
- so it's not the result of a borked version of vendor/rails.

Any ideas?

Thanks
Jeff
--~--~-~--~~~---~--~~
You received 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 on shared hosting

2008-12-01 Thread Joshua Partogi

Dear all,

Has anyone run RoR on cPanel based shared hosting? I've got my RoR
application on http://mydomain:10024/

Now I've uploaded all my Product model, view and controller.

Then I tried hitting: http://mydomain:10024/products but it didn't work

Is there any configuration I need to do on a shared hosting? Has
anyone experience with this before?

I'm sorry I have to ask it here since the hosting provided weren't
very supportive as they said it's the problem with the apps, but this
seems to be a relatively simple question :-(

Thank you in advance for the support.

-- 
Not by might nor by power, but by His Spirit.

Read my blog: http://joshuajava.wordpress.com/
Follow me on twitter: http://twitter.com/jpartogi

--~--~-~--~~~---~--~~
You received 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: call_rake results in sh: /opt/local/bin/rake: No such file or directory

2008-12-01 Thread Rafael

Ohhh... I am so sorry... just found out myself!
It was set manually by me in application.rb ;-)

one should remember, what has been coded :-D

thanks anyway

Rafael

On 2 Dez., 00:01, Rafael <[EMAIL PROTECTED]> wrote:
> Hi
>
> On my Linux Production Box, a Background Process results in following
> error:
>
> (rdb:5) call_rake(:send_mailing, {:mailing_id => params
> [:id].to_i, :rails_env => Rails.env})
> sh: /opt/local/bin/rake: No such file or directory
>
> The strange thing is, that actually the path is set correctly.
>
> -bash-3.1# sh
> sh-3.1# which rake
> /usr/bin/rake
> sh-3.1# bash
> bash-3.1# which rake
> /usr/bin/rake
>
> Does anybody has a clue, why / where I have to set this path, so that /
> usr/bin/rake is taken as a valid path?
> Thank you very much!
>
> regards
>
> Rafael
--~--~-~--~~~---~--~~
You received 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] call_rake results in sh: /opt/local/bin/rake: No such file or directory

2008-12-01 Thread Rafael

Hi

On my Linux Production Box, a Background Process results in following
error:

(rdb:5) call_rake(:send_mailing, {:mailing_id => params
[:id].to_i, :rails_env => Rails.env})
sh: /opt/local/bin/rake: No such file or directory

The strange thing is, that actually the path is set correctly.

-bash-3.1# sh
sh-3.1# which rake
/usr/bin/rake
sh-3.1# bash
bash-3.1# which rake
/usr/bin/rake

Does anybody has a clue, why / where I have to set this path, so that /
usr/bin/rake is taken as a valid path?
Thank you very much!

regards

Rafael
--~--~-~--~~~---~--~~
You received 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: Formatting issue

2008-12-01 Thread John Victor

STDOUT.write(line) fixed the problemthanks again for the help!



Frederick Cheung wrote:
> On 1 Dec 2008, at 11:44, John Victor wrote:
> 
>>   @my_data = `/usr/bin/my_data.rb`   #this causes data to be skewed
>>   [EMAIL PROTECTED] = File.open("/usr/bin/my_data.dat").read #this works
>> end
>> ---
>> index.rthml code:
>> <%= simple_format @my_data %>
>>
> 
> puts always appends a carriage return whereas write doesn't. if you
> changed it to STDOUT.write(line) it should be the same
> 
> 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: ActionMailer weirdness: bad html '=3d' for all '='

2008-12-01 Thread minka

the content type is text/html.
Where and how should I specify encoding?
Is it this:

 mail = TMail::Mail.new
 mail.transfer_encoding = "something"

What should "something" be?
this email is plain, vanilla, simple, nothing fancy, no special
characters, etc.
I just want something plain, simple etc that WORKS on ALL mail
servers.
thanks much!
minka


On Dec 1, 2:40 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Dec 1, 10:30 pm, minka <[EMAIL PROTECTED]> wrote:> I tried TMail parse and 
> I tried manually changing unicode to 7bit
> > ascii,
> > nothing worked. so finally I did it brute force. In my controller
>
> The email was encoded with quoted-printable. In that encoding = is a
> special character so is escaped with =3D.
>
> You can set the transfer encoding to something other than quoted-
> printable (eg not encode at all), but if you don't encode at all the
> mail could get garbled when passing through some mail servers. There's
> an example in the docs of how to set the transfer encoding to base64,
> you could instead just set it to 'identity' (actually actionmailer
> won't do any encoding if that setting is not either quoted-printable
> of base64 but you might as well pick a sensible name)
>
> If your email is indeed html, why are you setting the content type to
> text/plain ?
>
> Fred
>
> > @order = Order.find(params[:id])
> > email = TMail::Mail.new
> > email = OrderMailer.create_price(@order)
> > # BRUTE FORCE, nothing else worked!
> > # contaminated html in my emails!!
> > # All '=' became '=3D'
> > # NOTE TMail::Mail.parse() did not fix this.
> > email_fix = email.encoded.gsub(/[3][D]/,'') # replace '3D' with
> > empty string in email WORKED
> > email = TMail::Mail.parse(email_fix)
> > OrderMailer.deliver(email)
>
> > On Nov 29, 10:23 pm, "Kent Sibilev" <[EMAIL PROTECTED]> wrote:
>
> > > On Sun, Nov 30, 2008 at 12:46 AM, minka <[EMAIL PROTECTED]> wrote:
>
> > > > I am getting html output in my email body with spurious characters
> > > > that cannot be rendered, so that my links are not handled properly.
> > > > What am I not getting here?
>
> > > > My email body contains:
> > > > -clip-
> > > > mailto:";<%=h('[EMAIL PROTECTED]')%>?
> > > > Support">Support
>
> > > > with any issues. Please include your order number...
> > > > -clip-
> > > > I'm getting '=3d' for all '=' so that the  > > > href=3d... which is garbage.
>
> > > > I have tried using all possible combinations of h() and mailto
> > > > function: those don't fix it.
> > > > That is NOT the problem.
>
> > > > This is my method in order_mailer:
> > > >  def price(order)
> > > >@subject   = "Order Email
> > > >@recipients= order.email
> > > >@from  = '[EMAIL PROTECTED]'
> > > >@sent_on   = Time.now
> > > >@body["order"] = order
>
> > > >part :content_type => "text/plain",
> > > > :body => render_message("price_text_html", :order => order)
>
> > > >end
>
> > > > I tried content type text/html first, text/plain also does not work.
>
> > > > I can't use the utf code for '=', it isn't understood properly.
>
> > > > By the way, 3d is the hex unicode for '='.
>
> > > > What's up??
>
> > > SMTP protocol uses 7bit ASCII characters, so your emails must be
> > > properly encoded. You can read more about this 
> > > athttp://en.wikipedia.org/wiki/MIME.
>
> > > BTW, you can use tmail gem in order to decode your emails. I suspect
> > > something like this should work:
>
> > > require 'rubygems'
> > > require 'tmail'
>
> > > email = TMail::Mail.parse(email_text)
> > > puts email.body
>
> > > --
> > > Kent
--~--~-~--~~~---~--~~
You received 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: error w/dynamic fixtures

2008-12-01 Thread Pardee, Roy

Sweetness--thanks!

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Frederick Cheung
Sent: Thursday, November 27, 2008 4:59 AM
To: Ruby on Rails: Talk
Subject: [Rails] Re: error w/dynamic fixtures




On Nov 26, 10:49 pm, "Pardee, Roy" <[EMAIL PROTECTED]> wrote:
> Hey All,

> Can someone tell me what I'm doing wrong here?  Is the problem that 
> projects.yml is getting read in before statuses.yml?  If so, how do I control 
> that load order?

That is correct and the statuses method probably isn't even defined in the 
context you are using this in. The write way to do this is to put

status: active

in that fixture. As long as you have the status belongs_to association, rails 
will figure out that this means that you want the status_id column to have the 
value of the id of the status fixture with label 'active'. This won't work if 
your fixture for statuses explicitly sets an id.

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: The verdict on Rails scaffolding

2008-12-01 Thread Pardee, Roy

Ah, that scratched an itch for me--thanks for posting that.

Cheers,

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
David A. Black
Sent: Sunday, November 30, 2008 12:39 PM
To: Ruby on Rails: Talk
Subject: [Rails] Re: The verdict on Rails scaffolding


Hi --

On Sun, 30 Nov 2008, Nellboy wrote:

>
> Agreed, nice post there... The only thing i'd add to that, is that as
> a Rails beginner-becoming-intermediate, I actually really like the
> fact that you can get something up relatively quickly and then start
> hacking away at it to create an app... I'd also add that unless you
> really understand what's happening in terms of REST, etc. then it's
> near impossible to effectively build a respectable app... I've had a
> few moments of frustration/disappointment since I've created my first
> scaffold, but as long as you stay the course, and have some
> programming knowledge, it all makes perfect sense eventually...

You might find this interesting -- it's a kind of explanatory scaffold, so to 
speak, for REST in Rails:

http://dablog.rubypal.com/2008/11/24/restful-rails-for-the-restless

(Or you might be past the point where it's useful, but I thought I'd throw it 
out there just in case.)


David

--
Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL See http://www.rubypal.com for 
details Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)



--~--~-~--~~~---~--~~
You received 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: ActionMailer weirdness: bad html '=3d' for all '='

2008-12-01 Thread Frederick Cheung



On Dec 1, 10:30 pm, minka <[EMAIL PROTECTED]> wrote:
> I tried TMail parse and I tried manually changing unicode to 7bit
> ascii,
> nothing worked. so finally I did it brute force. In my controller
>
The email was encoded with quoted-printable. In that encoding = is a
special character so is escaped with =3D.

You can set the transfer encoding to something other than quoted-
printable (eg not encode at all), but if you don't encode at all the
mail could get garbled when passing through some mail servers. There's
an example in the docs of how to set the transfer encoding to base64,
you could instead just set it to 'identity' (actually actionmailer
won't do any encoding if that setting is not either quoted-printable
of base64 but you might as well pick a sensible name)

If your email is indeed html, why are you setting the content type to
text/plain ?


Fred


>     @order = Order.find(params[:id])
>     email = TMail::Mail.new
>     email = OrderMailer.create_price(@order)
>     # BRUTE FORCE, nothing else worked!
>     # contaminated html in my emails!!
>     # All '=' became '=3D'
>     # NOTE TMail::Mail.parse() did not fix this.
>     email_fix = email.encoded.gsub(/[3][D]/,'') # replace '3D' with
> empty string in email WORKED
>     email = TMail::Mail.parse(email_fix)
>     OrderMailer.deliver(email)
>
> On Nov 29, 10:23 pm, "Kent Sibilev" <[EMAIL PROTECTED]> wrote:
>
> > On Sun, Nov 30, 2008 at 12:46 AM, minka <[EMAIL PROTECTED]> wrote:
>
> > > I am getting html output in my email body with spurious characters
> > > that cannot be rendered, so that my links are not handled properly.
> > > What am I not getting here?
>
> > > My email body contains:
> > > -clip-
> > > mailto:";<%=h('[EMAIL PROTECTED]')%>?
> > > Support">Support
>
> > > with any issues. Please include your order number...
> > > -clip-
> > > I'm getting '=3d' for all '=' so that the  > > href=3d... which is garbage.
>
> > > I have tried using all possible combinations of h() and mailto
> > > function: those don't fix it.
> > > That is NOT the problem.
>
> > > This is my method in order_mailer:
> > >  def price(order)
> > >   [EMAIL PROTECTED]       = "Order Email
> > >   [EMAIL PROTECTED]    = order.email
> > >   [EMAIL PROTECTED]          = '[EMAIL PROTECTED]'
> > >   [EMAIL PROTECTED]       = Time.now
> > >   [EMAIL PROTECTED]"order"] = order
>
> > >    part :content_type => "text/plain",
> > >         :body => render_message("price_text_html", :order => order)
>
> > >    end
>
> > > I tried content type text/html first, text/plain also does not work.
>
> > > I can't use the utf code for '=', it isn't understood properly.
>
> > > By the way, 3d is the hex unicode for '='.
>
> > > What's up??
>
> > SMTP protocol uses 7bit ASCII characters, so your emails must be
> > properly encoded. You can read more about this 
> > athttp://en.wikipedia.org/wiki/MIME.
>
> > BTW, you can use tmail gem in order to decode your emails. I suspect
> > something like this should work:
>
> > require 'rubygems'
> > require 'tmail'
>
> > email = TMail::Mail.parse(email_text)
> > puts email.body
>
> > --
> > Kent
--~--~-~--~~~---~--~~
You received 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: ActionMailer weirdness: bad html '=3d' for all '='

2008-12-01 Thread minka

I tried TMail parse and I tried manually changing unicode to 7bit
ascii,
nothing worked. so finally I did it brute force. In my controller

@order = Order.find(params[:id])
email = TMail::Mail.new
email = OrderMailer.create_price(@order)
# BRUTE FORCE, nothing else worked!
# contaminated html in my emails!!
# All '=' became '=3D'
# NOTE TMail::Mail.parse() did not fix this.
email_fix = email.encoded.gsub(/[3][D]/,'') # replace '3D' with
empty string in email WORKED
email = TMail::Mail.parse(email_fix)
OrderMailer.deliver(email)


On Nov 29, 10:23 pm, "Kent Sibilev" <[EMAIL PROTECTED]> wrote:
> On Sun, Nov 30, 2008 at 12:46 AM, minka <[EMAIL PROTECTED]> wrote:
>
> > I am getting html output in my email body with spurious characters
> > that cannot be rendered, so that my links are not handled properly.
> > What am I not getting here?
>
> > My email body contains:
> > -clip-
> > mailto:";<%=h('[EMAIL PROTECTED]')%>?
> > Support">Support
>
> > with any issues. Please include your order number...
> > -clip-
> > I'm getting '=3d' for all '=' so that the  > href=3d... which is garbage.
>
> > I have tried using all possible combinations of h() and mailto
> > function: those don't fix it.
> > That is NOT the problem.
>
> > This is my method in order_mailer:
> >  def price(order)
> >@subject   = "Order Email
> >@recipients= order.email
> >@from  = '[EMAIL PROTECTED]'
> >@sent_on   = Time.now
> >@body["order"] = order
>
> >part :content_type => "text/plain",
> > :body => render_message("price_text_html", :order => order)
>
> >end
>
> > I tried content type text/html first, text/plain also does not work.
>
> > I can't use the utf code for '=', it isn't understood properly.
>
> > By the way, 3d is the hex unicode for '='.
>
> > What's up??
>
> SMTP protocol uses 7bit ASCII characters, so your emails must be
> properly encoded. You can read more about this 
> athttp://en.wikipedia.org/wiki/MIME.
>
> BTW, you can use tmail gem in order to decode your emails. I suspect
> something like this should work:
>
> require 'rubygems'
> require 'tmail'
>
> email = TMail::Mail.parse(email_text)
> puts email.body
>
> --
> Kent
--~--~-~--~~~---~--~~
You received 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: Incompatible versioning of InstantRails?

2008-12-01 Thread Frederick Cheung



On Dec 1, 9:46 pm, Scott Peterson <[EMAIL PROTECTED]>
wrote:
> I'm trying to get InstantRails running on a different computer than I
> originally started and I've gotten stuck.  I kind of think it's a
> versioning issue, but don't have a real good "reason why" I think that.
>
> Here's the deal.  I'd started fooling around with Rails a while back on
> my laptop and got to a point where I did a check-in to an svn
> repository.
>
> This turned out to be a good thing, as that laptop went away for a
> while.
>
> So, I've downloaded InstantRails 2.0 to my desktop, got the database set
> up for this application, and recovered the Ruby code from the
> repository, putting it in rails_apps.
>
> I then did a 'rails ' to make sure it would show up in the
> Rails Applications window, and asked the system not to overwrite any
> files it asked to.  So I believe I have the same setup as was on my
> laptop, with the possible exception of the version of InstantRails.
>
Unless you had frozen rails, you could be running a different version
of rails than the one you developed against.
I know nothing about instant rails but it would be insane if you
couldn't see the output from starting the app

Fred
> When I try to start this application, I see the window start and shut
> down almost immediately.  I don't see anything in the /log directory to
> help me out.
>
> I'm kind of guessing that I didn't originally develop in 2.0, so there's
> an incompatibility between my code and this framework.
>
> Can anyone verify that could be a problem, or put me on a path to
> further debug this issue?
>
> Thank you.
> --
> 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: Views and bindings

2008-12-01 Thread Fernando Perez


> def my_cool_block(&block)
>   content = capture(&block)
>   concat(content, block.binding)
> end
> 

FYI, block.binding is no longer required in Rails 2.2.2, and should 
raise a warning in the log.
-- 
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: localhost redirect/404

2008-12-01 Thread Scott Peterson

Hmm, I've noticed this problem only occurs if I type "localhost:3000" in 
the browser (without the http protocol).

So, no worries, although it is curious, I know how to properly access 
stuff now and have a better idea what to search on.
-- 
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] Incompatible versioning of InstantRails?

2008-12-01 Thread Scott Peterson

I'm trying to get InstantRails running on a different computer than I
originally started and I've gotten stuck.  I kind of think it's a
versioning issue, but don't have a real good "reason why" I think that.

Here's the deal.  I'd started fooling around with Rails a while back on
my laptop and got to a point where I did a check-in to an svn
repository.

This turned out to be a good thing, as that laptop went away for a
while.

So, I've downloaded InstantRails 2.0 to my desktop, got the database set
up for this application, and recovered the Ruby code from the
repository, putting it in rails_apps.

I then did a 'rails ' to make sure it would show up in the
Rails Applications window, and asked the system not to overwrite any
files it asked to.  So I believe I have the same setup as was on my
laptop, with the possible exception of the version of InstantRails.

When I try to start this application, I see the window start and shut
down almost immediately.  I don't see anything in the /log directory to
help me out.

I'm kind of guessing that I didn't originally develop in 2.0, so there's
an incompatibility between my code and this framework.

Can anyone verify that could be a problem, or put me on a path to
further debug this issue?

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: rake test:units failing.

2008-12-01 Thread Rob Biedenharn

On Dec 1, 2008, at 2:14 PM, Maulin Pathare wrote:
> Hello,
> I am a rails beginner and am having some trouble running the unit  
> tests
> using rake. i am following the example in the simply rails 2 book.
>
> I have a simple model with one field "name" and a validation for name
> that it cannot be empty
>
> my test file looks like this
>
>
>   1. require 'test_helper'
>   2.
>   3. class LadderTest < ActiveSupport::TestCase
>   4.
>   5.   def test_create_ladder_name_error
>   6. l = Ladder.create(:name => nil)
>   7. assert l.error.on(:name)
>   8.   end
>   9.
>  10. end
>
> When I run rake test:units from the shell I get the following error
>
> rake aborted!
> You have a nil object when you didn't expect it!
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.[]
>
> I am running rails version 2.2.2
>
> Does anyone know whats wrong? Thanks.


Perhaps you need a line between 6 & 7 with:

assert !l.valid?

Otherwise the error object associated to the model will not have been  
created.

-Rob

Rob Biedenharn  http://agileconsultingllc.com
[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: How do you display your Flash messages in your layouts?

2008-12-01 Thread Fernando Perez

AtsoK wrote:
> I just style a #notice div with CSS, and then in my application layout
> file, right above yield, I have:
> 
> <%= "#{flash[:notice]}" if flash[:notice] %>
> 
> And then to make it fade out after 5 seconds:
> 
> <% if flash[:notice] %>
>
>   new Effect.Fade('notice', { delay: 5 });
>
> <% end %>

Really cool trick. It's exactly what I was looking for. Do you have any 
idea how to combine visual_effects? The doc for scriptaculous is broken 
at github, it misses the demo page.
-- 
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: communicating between multiple rails applications?

2008-12-01 Thread Frederick Cheung



On Dec 1, 8:09 pm, Stedwick <[EMAIL PROTECTED]> wrote:
> Short story:
>
> My company has a rails application as our product. As we add more
> functionality, we are thinking of building new small, self-contained
> rails applications rather than just chugging along with our single
> monolithic application that we have right now.
>
> What is the best way to do this? Is it even recommended?

That's basically what we do. Separate apps have separate databases and
never touch the database of another app (so it's dead easy to isolate
an app (eg if it needs more horse power than the others or if it is
criticial) by just running it off a different database server.
Apps usually communicate with each other via private APIs over http.
Depending on how your app works you may find that ActiveResource is
useful, most of our interapplication communications don't really fit
with that model and so we haven't used that much

I would avoid synchronizing data, sounds like a headache (the only
place we do this is with our single sign on system, so that apps can
operate when it isn't available)

You may be wondering what to do when you want to display data from two
apps on the same page. The way we do it is to have javascript objects
on the page that fetch content from the different apps via ajax. A
single page may contain fragments of html rendered by any number of
applications.

My colleague and myself presented on this subject at railsconf europe
2008. The slides should still be available, as well as demo code used
in the presentation. Both should be linked from
http://www.texperts.com/2008/09/08/code-from-the-railsconf-europe-presentation/

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: Views and bindings

2008-12-01 Thread Frederick Cheung



On Dec 1, 8:02 pm, Joe Blow <[EMAIL PROTECTED]> wrote:
> hello all, I was hoping someone could describe to me how this works.
>
> Say I have some block of code like this
>
> <% my_cool_block do %>
>    <% my_var = 5 %>
>    <%= some_helper_method "My var" %>
> <% end %>
>
> And in my helper
>
> def my_cool_block(&block)
>   content = capture(&block)
>   concat(content, block.binding)
> end
>
> def some_helper_method(text)
>   "#{text} = #{my_var}
> end
>
> How can i get some_helper_method to 'know' about my_var which is in the
> scope of the my_cool_block block? And even better yet, how could I get
> the some_helper_method only to work when it is nested inside a
> my_cool_block block?

Well you could probably do it by messing around with bindings and eval
but that sounds like a sucky design. why not do something similar to
form_for, ie your my_cool_block method yields an object encapsulating
the state you want to share in its instance variables. usage could be

<% my_cool_block(5) do |helper| %>
  <%= helper.some_helper_method "My var %>
<% end %>

you could do other stuff too, eg call helper.with_value(5) and for the
block passed to with_value, my_var would have value 5

Fred
>
> Let me know if I can clarify anything for you.
>
> Thanks!
> --
> 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] communicating between multiple rails applications?

2008-12-01 Thread Stedwick

Short story:

My company has a rails application as our product. As we add more
functionality, we are thinking of building new small, self-contained
rails applications rather than just chugging along with our single
monolithic application that we have right now.

What is the best way to do this? Is it even recommended?

Long story:

My company, www.readMedia.com, specializes in press release
distribution over the web and our product is a 60,000 line Ruby on
rails application. We want to start adding some functionality that
sort of has to do with existing functionality, but not really. It
would use most of the same data, but the product could be sold
separately to new clients, or as an add-on to old clients.

The easiest thing to do would be to simply build that functionality
into our existing application. However, that has some drawbacks. As
the application gets bigger and bigger, and we hire more programmers,
the testing gets harder, the organization gets harder, deployment gets
harder, the code gets messier, et cetera.

What we would like to do instead is to build new functionality as a
separate rails application entirely. This has many advantages. Each
application/functionality can be upgraded independently, turned on or
off at will, have its own team of programmers who never have to worry
about stepping on the feet of other teams, source control becomes
easier, deployment is easier, et cetera.

The problem, to me, is that this seems to be technically really REALLY
hard, if not impossible. It sounds wonderful in theory, but can
(should) it even be done? Although the functionality of each
application would be different, they would share most of the same
data, such as our geographic table of zip codes and counties and our
history of sent releases.

One thought is to use the same database for each application. This
seems really tough. How would we keep the models in sync with each
other, because things such as validation is very important? Another
thought is to use multiple databases, one with the shared information,
and another for each application to hold its own stuff. Again, very
difficult. As far as I can tell, rails simply can't use multiple
databases. I've found a plug-in or two that supposedly does this, but
I'm not sure I would trust it.

Another thought is to have some API between the old system and the new
applications that we are making. Although certainly possible, this
seems like an extraordinary amount of work. How do we secure
communication between applications? How do we share user accounts?
Making an API would basically mean re-creating all of the existing
functionality in an outward facing manner that can be called from
another application. I don't really know how to do that, nor do I have
any experience with that sort of thing.

Another thought is to synchronize the data occasionally between our
applications. Have a background task that runs every night and updates
each database in sync with each other. This is a nice solution, but it
means that changes are propagated slowly, and syncing has historically
been very difficult in the programming world.

As my final thought, I've been thinking about what 37 signals does.
Their applications don't really interact at all. You have to login
separately to each one, data isn't shared between them, they are
basically separate products. In our situation we would like our
products to be more tightly intertwined than the 37 signals ones.
However, given that 37 signals doesn't do it, perhaps it's not
possible? It's not what rails was designed to do? It's a bad idea?

Anyway, what do all of you think? Do we just keep growing and growing
the main application? Do we force ourselves to create completely
separate products?

If we can somehow segment functionality into different rails
applications that still work together as a whole, what is the best way
to do it? Has anybody tried? Does anybody have any experience with
this? Please share any tools, plug-ins, or best practices that you
think could help.

Thanks a lot!
--~--~-~--~~~---~--~~
You received 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: Ecommerce site w/multiple subdomains

2008-12-01 Thread Frederick Cheung



On Dec 1, 7:27 pm, Wayne M <[EMAIL PROTECTED]> wrote:
>
> But that seems rather unweildy.  This is a critical business
> requirement since we want to create different stores with their own
> unique look and feel, but the actual data displayed comes from one
> master database and needs to be filtered appropriately based on the
> store the user is browsing.
>
Just the first thing that springs to mind.

in your product class do

named_scope :green, ...
named_scope :recycled, ...

def self.scope_for_subdomain(subdomain)
  send case subdomain
  when 'green' then :green
  when 'recycled' then :recycled
  else
:all
  end
end

and then your index action is

Product.scope_for_subdomain(request.subdomains.first).find :all
You could also just use anonymous scopes

Depending on what's in your app it might be better to pull the
selecting of the scope out into a before filter.

> Another critical requirement we have is that each individual product
> can have up to four prices, and the price is chosen based on the
> "store" the user is viewing it on (e.g. Product A is $15.00 on the
> mysite.com, but $12.00 on furniture.mysite.com).  I'm not sure what
> the best way to tackle that problem would be.
>
Again a random thought: products have a base price, and you have a
price_overrides table (products has_many price_overrides etc...)
Assuming you have Store objects describing the stores and a filter
that sets the current store you could have a method in your product
class similar to

def overriden_price(store)
  override = price_overrides.find_by_store_id store
  override ? override.price : self.price
end

and when you want to display the price to a user you just do

product.overriden_price(@current_store)

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] Views and bindings

2008-12-01 Thread Joe Blow

hello all, I was hoping someone could describe to me how this works.

Say I have some block of code like this

<% my_cool_block do %>
   <% my_var = 5 %>
   <%= some_helper_method "My var" %>
<% end %>

And in my helper

def my_cool_block(&block)
  content = capture(&block)
  concat(content, block.binding)
end

def some_helper_method(text)
  "#{text} = #{my_var}
end

How can i get some_helper_method to 'know' about my_var which is in the
scope of the my_cool_block block? And even better yet, how could I get
the some_helper_method only to work when it is nested inside a
my_cool_block block?

Let me know if I can clarify anything for you.

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: New to Rails... Help!

2008-12-01 Thread wfisk

class Country
  

  def people_tribes
peoples.map{|p|p.tribe}.join(',')
  end
end

On Dec 1, 8:51 pm, wfisk <[EMAIL PROTECTED]> wrote:
> I am sure there's a few ways of doing this.  Here's an easy one:
> declare a method in  the Country class and use that.
>
> class Country
>   
>
>   def people_tribes
>     peoples.map{|p|p.tribes}.join(',')
>   end
> end
>
> now in your view use country.people_tribes
>
> William
>
> Jay Mark wrote:
> > I am new to Ruby/InstantRails. I am using InstantRails 2.0.2 with mysql
> > database
>
> > My application is named Area, it has two tables: people and country
> > Table people has two columns: name and tribe
> > Table country has two columns: location and population
>
> > In the models I have:
> > class People < ActiveRecord::Base
> > belongs_to :country
> > end
> > class Country < ActiveRecord::Base
> >    has_many :peoples
> > end
>
> > I have country_id in the people's table.
>
> > I know I can do this:
> > <% @peoples.each do |people| %>
> > <%= people.name %>
> > <%= people.country.location %> // This works
>
> > What I want to do is to display location on country\index.html.erb
>
> > <% @countries.each do |country| %>
> > <%= link_to country.location, :action => "show", :id => country.id
> > %>
>
> > Then when I click on 'location' as a link, I want to display the 'tribe'
> > along side with 'population' for that 'location' on
> > view\country\show.html
>
> > <%=h @country.population %>   // this works
>
> > <%=h @country.tribe %>   // this does not works
>
> > My question is, how can I reference a column from the people's table
> > with a country's object? I know it works the other round.
>
> > Please help!
> > Cypray
> > --
> > 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: New to Rails... Help!

2008-12-01 Thread wfisk

I am sure there's a few ways of doing this.  Here's an easy one:
declare a method in  the Country class and use that.

class Country
  

  def people_tribes
peoples.map{|p|p.tribes}.join(',')
  end
end

now in your view use country.people_tribes

William


Jay Mark wrote:
> I am new to Ruby/InstantRails. I am using InstantRails 2.0.2 with mysql
> database
>
> My application is named Area, it has two tables: people and country
> Table people has two columns: name and tribe
> Table country has two columns: location and population
>
> In the models I have:
> class People < ActiveRecord::Base
> belongs_to :country
> end
> class Country < ActiveRecord::Base
>has_many :peoples
> end
>
> I have country_id in the people's table.
>
> I know I can do this:
> <% @peoples.each do |people| %>
> <%= people.name %>
> <%= people.country.location %> // This works
>
> What I want to do is to display location on country\index.html.erb
>
> <% @countries.each do |country| %>
> <%= link_to country.location, :action => "show", :id => country.id
> %>
>
>
> Then when I click on 'location' as a link, I want to display the 'tribe'
> along side with 'population' for that 'location' on
> view\country\show.html
>
> <%=h @country.population %>   // this works
>
> <%=h @country.tribe %>   // this does not works
>
> My question is, how can I reference a column from the people's table
> with a country's object? I know it works the other round.
>
> Please help!
> Cypray
> --
> 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] Ecommerce site w/multiple subdomains

2008-12-01 Thread Wayne M

My company is looking at redoing our legacy Classic ASP storefront,
and I'm thinking about doing it in Rails since the alternative is to
use a PHP-based solution called Magento that, while it looks nice, is
insanely abstract to the point of making me go blind (it uses a
database design principle called Entity-Attribute-Value or EAV which
basically is to keep database tables like hashmaps that can contain an
infinite number of values).

The principle requirement of this site is to be able to filter certain
products based on the subdomain, since we want to have different
"brands".  The products aren't specific to this subdomain, but the
subdomain only shows a subset of products.

For example:

www.mysite.com: displays all products with categories/subcategories
(i.e. no filtering)
furniture.mysite.com: displays only products/subcategories with a
parent category of furniture
green.mysite.com: displays only products/categories/subcategories with
a (boolean) flag recycled = true

How would I go about doing this?  The only way I can think would be to
have separate controllers for each "store", for example:

# Main store i.e. no subdomain
class StoreController < ApplicationController
  def index
@products = Products.find(:all)
  end
end

# furniture.mysite.com
class FurnitureStoreController < ApplicationController
  def index
@products = Products.find_all_by_category('Furniture')
  end
end

# green.mysite.com
class GreenStoreController < ApplicationController
  def index
@products = Products.find_all_by_recycled(true)
  end
end

But that seems rather unweildy.  This is a critical business
requirement since we want to create different stores with their own
unique look and feel, but the actual data displayed comes from one
master database and needs to be filtered appropriately based on the
store the user is browsing.

Another critical requirement we have is that each individual product
can have up to four prices, and the price is chosen based on the
"store" the user is viewing it on (e.g. Product A is $15.00 on the
mysite.com, but $12.00 on furniture.mysite.com).  I'm not sure what
the best way to tackle that problem would be.

Any assistance with either or both of these issues would be greatly
appreciated!
--~--~-~--~~~---~--~~
You received 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: aasm callback order?

2008-12-01 Thread dusty

Is this it?

http://didcoe.id.au/archives/finite-state-machines-in-rails

On Oct 27, 7:55 pm, Danimal <[EMAIL PROTECTED]> wrote:
> Thank you, Robert! I'll have to try out foxmarks. I suspect that the
> problem was PEBKAC... i.e. I probably thought "that's a cool page, I
> should bookmark it" and for whatever reason did not. Heh.
>
> Anyway... anyone else have an inkling about the page/wiki that I'm
> talking about? Or was it just in a dream?
>
> :-)
>
> -Danimal
>
> On Oct 27, 6:52 pm, Robert Zotter <[EMAIL PROTECTED]> wrote:
>
> > Ahhh I see. Sorry, Im not familiar with that wiki you are talking
> > about. However I can solve your bookmarking problem if you happen to
> > use Firefoxhttp://www.foxmarks.com/ :)
>
> > Good luck finding that wiki.
> > --
> > Robert Zotter
> > Zapient, LLC
> > Ruby on Rails Development and Consulting
>
> >http://www.zapient.comhttp://www.fromjavatoruby.com
>
> > On Oct 27, 5:48 pm, Danimal <[EMAIL PROTECTED]> wrote:
>
> > > Robert,
>
> > > I appreciate the fast response. Actually, though, there was a page
> > > somewhere that showed the FULL lifecycle of a ruby model that goes
> > > through before_save, validation, after_save, and all that along with
> > > the AASM transitions when the bang (!) character is included and when
> > > enters, exits, guards, transitions and such are used.
>
> > > I can practically visualize the page I remember... it was a listing of
> > > the order of each of these "steps" (callbacks and such).
>
> > > In other words, it was very similar to the first part of 
> > > this:http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
> > > but with the AASM hooks included.
>
> > > It's just bugging me because I thought I bookmarked the page and I
> > > can't find my bookmark. *sigh*
>
> > > -Danimal
>
> > > On Oct 27, 6:42 pm, Robert Zotter <[EMAIL PROTECTED]> wrote:
>
> > > > Danimal,
>
> > > > Usually the best place to look is the actual source 
> > > > itself.http://github.com/omghax/acts_as_state_machine/tree/master/lib/acts_a...
>
> > > > Looks like this is what you are looking for
> > > > :entering
> > > > :entered
> > > > :exited
>
> > > > The entering and exiting methods call the @enter and @exit options
> > > > respectively which are passed in during instantiation.
>
> > > > Cheers
>
> > > > --
> > > > Robert Zotter
> > > > Zapient, LLC
> > > > Ruby on Rails Development and Consulting
>
> > > >http://www.zapient.comhttp://www.fromjavatoruby.com
>
> > > > On Oct 27, 5:31 pm, Danimal <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello!
>
> > > > > Sometime ago I ran across a webpage where someone had identified the
> > > > > full callback sequence for an object lifecycle including AASM with
> > > > > it's :enter and :exit and whatnot callbacks. Unfortunately, I can't
> > > > > find it and searches don't seem to help.
>
> > > > > Does anyone have a reference to a page that shows the callback
> > > > > sequence with Acts As State Machine (the gem)?
>
> > > > > I think there was a Wiki page on github with this, but I can't find
> > > > > it. Grrr.
>
> > > > > Thanks!
>
> > > > > -Danimal
--~--~-~--~~~---~--~~
You received 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] rake test:units failing.

2008-12-01 Thread Maulin Pathare

Hello,
I am a rails beginner and am having some trouble running the unit tests
using rake. i am following the example in the simply rails 2 book.

I have a simple model with one field "name" and a validation for name
that it cannot be empty

my test file looks like this


   1. require 'test_helper'
   2.
   3. class LadderTest < ActiveSupport::TestCase
   4.
   5.   def test_create_ladder_name_error
   6. l = Ladder.create(:name => nil)
   7. assert l.error.on(:name)
   8.   end
   9.
  10. end

When I run rake test:units from the shell I get the following error

rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

I am running rails version 2.2.2

Does anyone know whats wrong? 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] New to Rails... Help!

2008-12-01 Thread Jay Mark

I am new to Ruby/InstantRails. I am using InstantRails 2.0.2 with mysql
database

My application is named Area, it has two tables: people and country
Table people has two columns: name and tribe
Table country has two columns: location and population

In the models I have:
class People < ActiveRecord::Base
belongs_to :country
end
class Country < ActiveRecord::Base
   has_many :peoples
end

I have country_id in the people's table.

I know I can do this:
<% @peoples.each do |people| %>
<%= people.name %>
<%= people.country.location %> // This works

What I want to do is to display location on country\index.html.erb

<% @countries.each do |country| %>
<%= link_to country.location, :action => "show", :id => country.id
%>


Then when I click on 'location' as a link, I want to display the 'tribe'
along side with 'population' for that 'location' on
view\country\show.html

<%=h @country.population %>   // this works

<%=h @country.tribe %>   // this does not works

My question is, how can I reference a column from the people's table
with a country's object? I know it works the other round.

Please help!
Cypray
-- 
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: Getting at DBI connection via ActiveRecord connection

2008-12-01 Thread Wes Gamble

Upon further inspection, I see that AR doesn't depend on DBI.  I wonder 
why not...

As it turns out, I'm in a JRuby environment, so I can just do prepared 
statements via that method.

Thanks,
Wes
-- 
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: Building a Root Route with a Generator

2008-12-01 Thread Tim K.

Okay cool. Is there a better way to call gsub_file protected method
then by copying it into the generator? It's in
Rails::Generator::Commands::Base.

On Dec 1, 12:35 pm, "Brandon Keepers" <[EMAIL PROTECTED]> wrote:
> On Mon, Dec 1, 2008 at 10:52 AM, Tim K. <[EMAIL PROTECTED]> wrote:
> > My question is this... Is there an better way to be doing this? It
> > seems like a lot of insanity just to add a root route.
>
> You would think so, but there doesn't seem to be.  `script/generate
> resource` also adds routes, but looking at the source, they're doing
> something similar:
>
>         def route_resources(*resources)
>           resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
>           sentinel = 'ActionController::Routing::Routes.draw do |map|'
>
>           logger.route "map.resources #{resource_list}"
>           unless options[:pretend]
>             gsub_file 'config/routes.rb',
> /(#{Regexp.escape(sentinel)})/mi do |match|
>               "#{match}\n  map.resources #{resource_list}\n"
>             end
>           end
>         end
>
> Brandon
> --
> --- 
> -
> Training by Collective Idea: Ruby on Rails training in a vacation 
> settinghttp://training.collectiveidea.com– San Antonio, TX – Jan 20-23
--~--~-~--~~~---~--~~
You received 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] localhost redirect/404

2008-12-01 Thread Scott Peterson

I think this is more of a windows question than rails per se, but I
can't see the answer.

I've just installed InstantRails 2.0 on my XP machine.  Both Apache and
mySQL start up fine.  I spark up the 'cookbook' app, and notice that
Mongrel starts it on port 3001, but other than that, pretty much the
same as my laptop (I think, I don't have access to that right now).

However, when I go to the browser, localhost:3001 directs to local:3001
and gives me the 404 page.

The only thing in my hosts file is a line for 127.0.0.1 going to
localhost, so it doesn't seem like that's the problem.

I've also tried port 3000, and hitting the server directly (127.0.0.1),
all result in 404.

Adding the mapping in hosts from 127.0.0.1 to 'www.mycookbook.com' per
the readme works great for the cookbook application, but I'd like to
just be able to hit locahost:3000 and run whatever application currently
is started for development.

Not sure where else to go from here.  Anyone got an idea what I'm
missing?

There's not a post-unzip setup step that I've forgotten for InstantRails
maybe?
-- 
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] Getting at DBI connection via ActiveRecord connection

2008-12-01 Thread Wes Gamble

I have a standalone batch program that is going to move data between two
databases.

I am taking advantage of the AR connection semantics in database.yml to
get connections to these two DBs.  But I want to do all of my DB access
at the DBI/DBD level for performance reasons.

I am having trouble getting access to the underlying DBI handle so that
I can prepare SQL statements, execute them etc.

>From a connection retrieve via AR::Base.retrieve_connection, how can I
get at the DBI handle?

Is it possible that I've misunderstood that AR DB access is built on top
of DBI?

Thanks,
Wes
-- 
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: Building a Root Route with a Generator

2008-12-01 Thread Brandon Keepers

On Mon, Dec 1, 2008 at 10:52 AM, Tim K. <[EMAIL PROTECTED]> wrote:
> My question is this... Is there an better way to be doing this? It
> seems like a lot of insanity just to add a root route.

You would think so, but there doesn't seem to be.  `script/generate
resource` also adds routes, but looking at the source, they're doing
something similar:

def route_resources(*resources)
  resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
  sentinel = 'ActionController::Routing::Routes.draw do |map|'

  logger.route "map.resources #{resource_list}"
  unless options[:pretend]
gsub_file 'config/routes.rb',
/(#{Regexp.escape(sentinel)})/mi do |match|
  "#{match}\n  map.resources #{resource_list}\n"
end
  end
end

Brandon
-- 

Training by Collective Idea: Ruby on Rails training in a vacation setting
http://training.collectiveidea.com – San Antonio, TX – Jan 20-23

--~--~-~--~~~---~--~~
You received 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: valid? is not working in Rails 2.2.2

2008-12-01 Thread Bobnation

It just seems like there are too many conditions being tossed at the
validation method from wherever you are setting up those variables.

On Dec 1, 3:56 am, Vipin Vm <[EMAIL PROTECTED]> wrote:
> Hi Rick
>
> when i commented the following line, it worked fine.
>
> validates_presence_of :user_name, :password, :email, :display_name
>
> then what could be wrong?
>
> Vipin
>
> --
> 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: Checking if an association already exists between two records

2008-12-01 Thread Brandon Keepers

On Mon, Dec 1, 2008 at 11:07 AM, Gearóid O'Ceallaigh
<[EMAIL PROTECTED]> wrote:
>
> Hey,
>
> I'm creating an app which has two models - bands and users. A
> relationship between users and bands in many to many.
>
> However, when I'm adding an existing to user to a band (ie. updating
> the bands_users table) how can i check if the relationship between the
> user and the band already exists? For example, if a user with ID of 3
> was already a member of a band with ID 5, and then somebody tried to
> make this connection again - I want to output an error message. Is
> there some special validation I can place in a bands_users.rb that
> validated the uniqueness of the entire record?

There is a :uniq option that will ignore duplicates:

  class Band < ActiveRecord::Base
has_and_belongs_to_many :users, :uniq => true
  end

This won't raise an error, but it will prevent duplicate associations.
 Hope that Helps

Brandon
-- 

Training by Collective Idea: Ruby on Rails training in a vacation setting
http://training.collectiveidea.com — San Antonio, TX — Jan 20-23

--~--~-~--~~~---~--~~
You received 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] Inserting to a View - Auto Incrementing Issue

2008-12-01 Thread Paul Harv

Hi,

My app has a model defined like this:

MyModel < ActiveRecord::Base
  set_table_name "SOME_LEGACY_VIEW"
  set_primary_key "LEGACY_ID"
end

The Database is DB2.
The view definition looks like this

SELECT
LEGACY_ID, NAME
FROM LEGACY_TABLE

When I create a new model and try to save it by doing this...

myModel = MyModel.new
myModel.name = "TEST"
myModel.save

Rails is creating an INSERT statement which includes the primary key -
LEGACY_ID - set to an ampty String. This blows up auto-increment on
LEGACY_TABLE.

Anyone seen this? Suggested solution.

Note - if LEGACY_ID is removed from the view it works OK, but I'm
working with requirements that say it should be there.

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: Sending mail templates to a mailinglist

2008-12-01 Thread Dave Smith

Frederick Cheung wrote:
> On 1 Dec 2008, at 16:58, Dave Smith wrote:
> 
>> recipient, subject, message to the emailer model.
>>
>> However I created a mailings scaffold which holds each of the email
>> addresses, and names for the people on the mailinglist (with a one to
>> many relationship).
>>
>> So now I am stuck as I dont know how to create a button that sends an
>> email to all the mailings in a mailinglist with the  
>> mailinglist_template
>> associated with that mailinglist!!
>>
> Doesn't that just mean that recipients = mailinglist.people.collect {|
> person| person.email_address}
> ?
> Fred

yeah well in my mailinglist controller I have put

@mailinglist_mailings = @mailinglist.mailings.collect

so essentially very similar
-- 
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: Sending mail templates to a mailinglist

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 16:58, Dave Smith wrote:

>
> Hi Fred,
>
> At present the recipient is a single email address coming from the
> emailer page (just to test the mailer works).
>
> I have moved the sendmail form into the mailinglists index view page
> (and also moved the sendmail function from the emailer controller to  
> the
> mailinglist controller) and it still works fine by sending the
> recipient, subject, message to the emailer model.
>
> However I created a mailings scaffold which holds each of the email
> addresses, and names for the people on the mailinglist (with a one to
> many relationship).
>
> So now I am stuck as I dont know how to create a button that sends an
> email to all the mailings in a mailinglist with the  
> mailinglist_template
> associated with that mailinglist!!
>
Doesn't that just mean that recipients = mailinglist.people.collect {| 
person| person.email_address}
?
Fred

> Any help on this would be greatly appreciated!!
>
> Kindest Regards,
>
> Louis
>
> Frederick Cheung wrote:
>> On 1 Dec 2008, at 10:54, Dave Smith wrote:
>>
>>>
>>>
>>> As a noob to rails I am struggling with being able to send a mail
>>> template (html) stored in my database to all the users on a mailing
>>> list. I can use the emailer page to send the mail template to a  
>>> single
>>> email address, but I want to be able to put a button on the
>>> mailinglists
>>> show page that sends the mail template to all the mailings in the
>>> mailinglist. The code is below for the key sections I am using.
>>>
>>
>> Well instead of doing
>>
>> Emailer.deliver_contact(recipient, subject, message)
>>
>> You could clearly do
>>
>> recipients.each do |recipient|
>>   Emailer.deliver_contact(recipient, subject, message)
>> end
>>
>> assuming that recipients was some collection of email addresses
>>
>> 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: Sending mail templates to a mailinglist

2008-12-01 Thread Dave Smith

Hi Fred,

At present the recipient is a single email address coming from the 
emailer page (just to test the mailer works).

I have moved the sendmail form into the mailinglists index view page 
(and also moved the sendmail function from the emailer controller to the 
mailinglist controller) and it still works fine by sending the 
recipient, subject, message to the emailer model.

However I created a mailings scaffold which holds each of the email 
addresses, and names for the people on the mailinglist (with a one to 
many relationship).

So now I am stuck as I dont know how to create a button that sends an 
email to all the mailings in a mailinglist with the mailinglist_template 
associated with that mailinglist!!

Any help on this would be greatly appreciated!!

Kindest Regards,

Louis

Frederick Cheung wrote:
> On 1 Dec 2008, at 10:54, Dave Smith wrote:
> 
>>
>>
>> As a noob to rails I am struggling with being able to send a mail
>> template (html) stored in my database to all the users on a mailing
>> list. I can use the emailer page to send the mail template to a single
>> email address, but I want to be able to put a button on the  
>> mailinglists
>> show page that sends the mail template to all the mailings in the
>> mailinglist. The code is below for the key sections I am using.
>>
> 
> Well instead of doing
> 
> Emailer.deliver_contact(recipient, subject, message)
> 
> You could clearly do
> 
> recipients.each do |recipient|
>Emailer.deliver_contact(recipient, subject, message)
> end
> 
> assuming that recipients was some collection of email addresses
> 
> 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: Checking if an association already exists between two records

2008-12-01 Thread Thorsten Müller

You can use the scopt attribute of validates_uniqueness_of
But this would require, that the intermediate table between
users/bands has it's own model

in this model (BandsUsers)
validates_uniqueness_of :user_id, :scope => band_id


--~--~-~--~~~---~--~~
You received 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: webrat - click on any (named) html element

2008-12-01 Thread Clemens Wyss

Bryan Helmkamp wrote:
> Webrat only supports clicking on links and buttons when running as a
> browser simulator (without Selenium). Without JavaScript, there's no
> way to know what clicking anything else would do, so there's not a
> reason to support it.
I agree

> 
> Also, there's now a dedicated Webrat mailing list at:
> 
> http://groups.google.com/group/webrat
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] Checking if an association already exists between two records

2008-12-01 Thread Gearóid O'Ceallaigh

Hey,

I'm creating an app which has two models - bands and users. A
relationship between users and bands in many to many.

However, when I'm adding an existing to user to a band (ie. updating
the bands_users table) how can i check if the relationship between the
user and the band already exists? For example, if a user with ID of 3
was already a member of a band with ID 5, and then somebody tried to
make this connection again - I want to output an error message. Is
there some special validation I can place in a bands_users.rb that
validated the uniqueness of the entire record?

Thanks,
  -ger
--~--~-~--~~~---~--~~
You received 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 ruby script/server work

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 15:51, Margareth Florián wrote:

> Thanks for your answer Fred..
>
> I am in development environment, I have config.cache_classes = false  
> (in my development.rb file)
> In the environment.rb file i have require  
> File.join(File.dirname(__FILE__), 'boot').
>

> I try  by instancing load_once_path: Dependencies.load_once_path? 
> (RAILS_ROOT) in my environment.rb
> But does not work. I am not an ruby expert.
>

If you are using require to load any of your application's classes,  
then don't

Fred

>
> Can you explain me what can I do?
>
> Thank you very much.
> Margareth
>
> 2008/11/28 Frederick Cheung <[EMAIL PROTECTED]>
>
>
>
> On Nov 28, 3:18 pm, mafloria <[EMAIL PROTECTED]> wrote:
> > I'm develop an application. I have rails 2.2 but when I want to see
> > changes in my application (by reloading) I have to restart the  
> server.
> >
> > What i need to do for do not restart??
> >
>
> Assuming you are running in development mode and that you haven't
> fiddled with the config.cache_classes settings, one way of messing up
> auto reloading is by using require to require stuff that rails is
> capable of loading automatically.
>
> 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] Building a Root Route with a Generator

2008-12-01 Thread Tim K.

I'm looking for a better approach... then what I'm currently doing.

I'm working on a generator that will help me setup my base projects
with many of my common defaults that I use internally. Now I know that
generators have the route_resources method that allows a person to
create a resource in the routes file, but is there a way to create the
map.root :controller => 'name' entry as well?

Here is what I've done. I customized the route_resources method to be
something like this:

def add_root_route
  sentinel = 'ActionController::Routing::Routes.draw do |map|'
  gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi
do |match|
"#{match}\n  map.root :controller => \"welcome\"\n"
  end
end

And then just copied the gsub_file method to my generator (it was a
protected method and I couldn't think of another way to execute it -
thoughts?).

I then have a bit that does:

  action = File.basename($0)
  case action
when "generate"
  add_root_route
when "destroy"
  puts
""
  puts "Make sure you remove the map.root from the /config/
routes.rb"
  puts
""
  end

Which makes sure it only runs when they are running generate.

My question is this... Is there an better way to be doing this? It
seems like a lot of insanity just to add a root route.
--~--~-~--~~~---~--~~
You received 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 ruby script/server work

2008-12-01 Thread Margareth Florián
Thanks for your answer Fred..

I am in development environment, I have config.cache_classes =* false* (in
my development.rb file)
In the environment.rb file i have require File.join(File.dirname(*__FILE__*
), 'boot').
I try  by instancing load_once_path: Dependencies.load_once_path?(RAILS_ROOT)
in my environment.rb
But does not work. I am not an ruby expert.

Can you explain me what can I do?

Thank you very much.
Margareth

2008/11/28 Frederick Cheung <[EMAIL PROTECTED]>

>
>
>
> On Nov 28, 3:18 pm, mafloria <[EMAIL PROTECTED]> wrote:
> > I'm develop an application. I have rails 2.2 but when I want to see
> > changes in my application (by reloading) I have to restart the server.
> >
> > What i need to do for do not restart??
> >
>
> Assuming you are running in development mode and that you haven't
> fiddled with the config.cache_classes settings, one way of messing up
> auto reloading is by using require to require stuff that rails is
> capable of loading automatically.
>
> 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: Sending mail templates to a mailinglist

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 10:54, Dave Smith wrote:

>
>
> As a noob to rails I am struggling with being able to send a mail
> template (html) stored in my database to all the users on a mailing
> list. I can use the emailer page to send the mail template to a single
> email address, but I want to be able to put a button on the  
> mailinglists
> show page that sends the mail template to all the mailings in the
> mailinglist. The code is below for the key sections I am using.
>

Well instead of doing

Emailer.deliver_contact(recipient, subject, message)

You could clearly do

recipients.each do |recipient|
   Emailer.deliver_contact(recipient, subject, message)
end

assuming that recipients was some collection of email addresses

Fred

> I have been trying to figure out a solution for 4 days now and still
> cannot get anything working and am loosing the will to live!!
>
> Please if anyone could help me on this one I would be very very
> greatfull.
>
> Regards,
>
> David
>
>
> emailer controller
> ---
>
> class Admin::EmailerController < Admin::AdminController
>   def sendmail
>  email = params[:email]
>  recipient = email["recipient"]
>  subject = email["subject"]
>  message = email["message"]
>  Emailer.deliver_contact(recipient, subject, message)
>  return if request.xhr?
>  render :text => 'Message sent successfully'
>   end
>
>   #def index
>#  render :file => 'app\views\admin\emailer\index.html.erb'
>   #end
>
> end
>
> --
>
> emailer index.html.erb
> ---
>
> Send Email
>
> <% form_tag :action => "sendmail" do %>
>
>Subject:
><%= text_field 'email', 'subject' %>
>
>
>Recipient:
><%= text_field 'email', 'recipient' %>
>
>
>Message
><%= text_area 'email', 'message' %>
>
><%= submit_tag "sendmail" %>
> <% end %>
> -
>
> mailinglists show.html.erb - using the mail_template
> -
> Mail Template(s) in use:
> <% for mail_template in @mailinglist_templates %>
> <%= link_to "#{mail_template.name}",
> admin_mail_template_path(mail_template), :class => 'websnapr' %>
> <%= link_to 'Edit', edit_admin_mail_template_path(mail_template) %>
>
>
>  <% end %>
> 
> 
>  Subscriber List
> <% for mailing in @mailinglist_mailings %>
><%= mailing.email_address %>
> <% end %>
>
> --
>
> oh and here is my mailer model
>
> 
> class Admin::Emailer < ActionMailer::Base
>def contact(recipient, subject, message, sent_at = Time.now)
>  @subject = subject
>  @recipients = recipient
>  @from = '[EMAIL PROTECTED]'
>  @sent_on = sent_at
>  @content_type = "text/html"
>  @body["title"] = 'This is title'
>@body["email"] = '[EMAIL PROTECTED]'
> @body["message"] = message
>  @headers = {}
>   end
> end
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


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



[Rails] Re: find query

2008-12-01 Thread Petr Bobek


> I'd write the above query like this:
> u = User.find_by_username ...
> u.friendships.find :all, :joins => :friends, :order =>
> 'last_activity_at desc'

Cheers Fred, this is the trick I was looking for.
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: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 13:15, balaji rajagopal wrote:

> Hi
>
>  I used <%= debug(params)%> in the view to display the
>
>  !map:HashWithIndifferentAccess
> controller: wizard
> action: stage1
>
> I can't understand the error.Please anyone rectify the error.
>

Just look in development.log. It shows you what params are received.  
from that it should be clear.

Fred

> Thanks ®ards
> Balaji
>
>
>
>
>
> On 12/1/08, Frederick Cheung <[EMAIL PROTECTED]> wrote:
>
>
> On Dec 1, 10:35 am, "balaji rajagopal" <[EMAIL PROTECTED]>
> wrote:
> > Hi
> >My Resortclass application is
> > Field =>id: resortclass
> > Value=>1:a
> > 2:bin store in resortclasses table
> >
> > My Resortbasic application is
> > Field =>id: resortclassid
> > Value=>1:1
> > 2:1   in store in resortbasics table
> > I select 2nd value is  but it is stored the id value is 1and
> > I select 2nd value is  but it is stored the id value is 1
> > So i doubt error in wizard controller section
> >
> Check again. I can assure you that resortclassid is not in params[:
> resortclassid] but is somewhere else.
> Don't flail around blindly, use the debugger to inspect the params
> hash and you'll find out soon enough (or as a poor man's alternative
> use
> <%= debug(params)%> in the view to display all the parameters received
>
> 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: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread balaji rajagopal
Hi

 I used <%= debug(params)%> in the view to display the

 !map:HashWithIndifferentAccess
controller: wizard
action: stage1

I can't understand the error.Please anyone rectify the error.

Thanks ®ards
Balaji





On 12/1/08, Frederick Cheung <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Dec 1, 10:35 am, "balaji rajagopal" <[EMAIL PROTECTED]>
> wrote:
> > Hi
> >My Resortclass application is
> > Field =>id: resortclass
> > Value=>1:a
> > 2:bin store in resortclasses table
> >
> > My Resortbasic application is
> > Field =>id: resortclassid
> > Value=>1:1
> > 2:1   in store in resortbasics table
> > I select 2nd value is  but it is stored the id value is 1and
> > I select 2nd value is  but it is stored the id value is 1
> > So i doubt error in wizard controller section
> >
> Check again. I can assure you that resortclassid is not in params[:
> resortclassid] but is somewhere else.
> Don't flail around blindly, use the debugger to inspect the params
> hash and you'll find out soon enough (or as a poor man's alternative
> use
> <%= debug(params)%> in the view to display all the parameters received
>
> 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: Bizon specifications for ruby

2008-12-01 Thread cheef

Damn, you right..

On 1 дек, 15:10, Frederick Cheung <[EMAIL PROTECTED]> wrote:
> On 1 Dec 2008, at 11:50, cheef wrote:
>
>
>
> > Hi, i am searching an bizon (or rbizon) specification for ruby. Will
> > be very glad for any help =)
>
> You might try asking on the ruby list rather than here as it isn't  
> really a rails question.
>
> 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] config.gem dependencies broken?

2008-12-01 Thread Jörg Battermann

Hello there,

I am having some strange problems with my project's gem dependencies
on my staging server and really don't know where this is coming from.

My config.gem entries in the environment.rb file are the following:

--- snip ---

  config.gem "geonames"
  config.gem "yelp"
  config.gem 'oauth', :version => ">= 0.2.1"
  config.gem "vikinggem", :lib => "viking"
  config.gem "RedCloth", :lib => "redcloth", :version => ">= 4.0"
  config.gem 'pager-retardase_inhibitor', :lib =>
'retardase_inhibitor', :source => 'http://gems.github.com'
  config.gem 'right_aws'
  config.gem 'mime-types', :lib => 'mime/types'
  config.gem 'json'
  config.gem 'hpricot'
  config.gem 'uuidtools'
  config.gem 'chronic'
  config.gem 'htmlentities'

--- snip ---

Now when I do a gem list --local on the affected machine, it looks
like this:

*** LOCAL GEMS ***

--- snip ---

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
capistrano (2.5.2)
chronic (0.2.3)
fastthread (1.0.1)
geonames (0.2.2)
highline (1.5.0)
hoe (1.8.2)
hpricot (0.6.164)
htmlentities (4.0.0)
image_science (1.1.3)
json (1.1.3)
mime-types (1.15)
net-scp (1.0.1)
net-sftp (2.0.1)
net-ssh (2.0.4)
net-ssh-gateway (1.0.0)
oauth (0.2.7)
pager-retardase_inhibitor (1.0.20080518)
passenger (2.0.3)
rack (0.4.0)
rails (2.2.2)
rake (0.8.3)
RedCloth (4.1.1)
right_aws (1.9.0)
right_http_connection (1.2.4)
rspec (1.1.11)
ruby-hmac (0.3.2)
ruby-openid (2.1.2)
rubyforge (1.0.1)
rubygems-update (1.3.1)
RubyInline (3.8.1)
uuidtools (1.0.4)
vikinggem (0.0.3)
yelp (0.2.1)
ZenTest (3.11.0)

--- snip ---


Nooow when I do a rake gems in my project's folder, I get the
following:

--- snip ---

(in /var/www/project_abc/releases/20081201014151)
 - [I] geonames
 - [I] yelp
- [I] json = 1.1.3
- [ ] hoe = 1.8.2
- [ ] rubyforge = 1.0.1
- [I] rake = 0.8.3
 - [I] oauth >= 0.2.1
- [I] ruby-hmac = 0.3.2
   - [ ] hoe = 1.8.2
   - [ ] rubyforge = 1.0.1
   - [I] rake = 0.8.3
- [ ] hoe = 1.8.2
- [ ] rubyforge = 1.0.1
- [I] rake = 0.8.3
 - [I] vikinggem
 - [I] RedCloth >= 4.0
rake aborted!
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.dependencies
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails/gem_dependency.rb:
77:in `dependencies'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`to_proc'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails/gem_dependency.rb:
80:in `map'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails/gem_dependency.rb:
80:in `dependencies'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake:15:in
`print_gem_status'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake:4
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake:3:in
`each'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake:3
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in
`invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

--- snip ---

First of all, why is it saying hoe/rubyforge is missing (as they are
listed in the gems list --local list) & secondly, why's there a
nil.dependencies exception?


Apparently this also does break my app, since all views that rely on
acts_as_textiled throw a "ActionView::TemplateError (uninitialized
constant Err::Acts::Textiled::ClassMethods::RedCloth) .." exception.


I already did a sudo gem uninstall/clean/install of all gems.. no
change :-/

[EMAIL PROTECTED]:~$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
[EMAIL PROTECTED]:~$ rails -v
Rails 2.2.2

Hrm. Any ideas? Suggestions? I am seriously kinda lost here...


Thanks,
-Joerg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group,

[Rails] Functional Test - RJS Template not found

2008-12-01 Thread Florian

Hi Everyone,

i have the following Problem. For one of my controllers im using
a .js.rjs template for the create action. This works fine in
development and production mode. However, when i try to run a
functional test for this action, i get the following error:

ActionView::MissingTemplate: Missing template connectors/create.erb in
view path [...]/app/views:

Only if i explicitly use "render :template => 'connectors/
create.js.rjs'" the rjs template is found and the test runs through.
Do you have any idea why the template is not found and used without
this? Im now at Rails 2.2.2.

Thanks!

Florian

--~--~-~--~~~---~--~~
You received 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: Formatting issue

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 11:44, John Victor wrote:

>
> ---
> my_data.rb code:
> data.each do |line|
>   a.write(line) #--this writes to my_data.dat
>   puts line #--this puts the same data to STDOUT
> end
> ---
> controller code:
> def index
>   @my_data = `/usr/bin/my_data.rb`   #this causes data to be skewed
>   [EMAIL PROTECTED] = File.open("/usr/bin/my_data.dat").read #this works
> end
> ---
> index.rthml code:
> <%= simple_format @my_data %>
>

puts always appends a carriage return whereas write doesn't. if you  
changed it to STDOUT.write(line) it should be the same

Fred
> Perhaps the way I'm writing to STDOUT in my_data.rb is causing the
> skewing of my data?
>
> thanks
>
> vic
>
>
>
>
> -- 
> 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: Bizon specifications for ruby

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 11:50, cheef wrote:

>
> Hi, i am searching an bizon (or rbizon) specification for ruby. Will
> be very glad for any help =)

You might try asking on the ruby list rather than here as it isn't  
really a rails question.

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] Bizon specifications for ruby

2008-12-01 Thread cheef

Hi, i am searching an bizon (or rbizon) specification for ruby. Will
be very glad for any help =)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Formatting issue

2008-12-01 Thread John Victor

Hassan Schroeder wrote:

> They don't line up in this email, either :-)
...heheI know, I'm sorry that wasn't much of a help :-)

> Are you trying to display this in PRE tags or equivalent CSS with a
> monospace font?

..good call on this one though, I added PRE tags on my index.rhtml and 
the data is looking the way I want it...which is great news.

I am still a bit baffled as to why I have to write the data to a file 
first, then open the file and put it in PRE tags as opposed to using 
PUTS statements in my original script and assigning that to a variable 
which gets called by my index page which still causes the format to be 
skewed.
---
my_data.rb code:
data.each do |line|
   a.write(line) #--this writes to my_data.dat
   puts line #--this puts the same data to STDOUT
end
---
controller code:
def index
   @my_data = `/usr/bin/my_data.rb`   #this causes data to be skewed
   [EMAIL PROTECTED] = File.open("/usr/bin/my_data.dat").read #this works
end
---
index.rthml code:
<%= simple_format @my_data %>

Perhaps the way I'm writing to STDOUT in my_data.rb is causing the 
skewing of my data?

thanks

vic




-- 
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: find query

2008-12-01 Thread Frederick Cheung



On Dec 1, 9:47 am, Petr Bobek <[EMAIL PROTECTED]>
wrote:
> > That sort would have ordered the users (from the 'main' find) by
> > descending last_activity_at, not the associations (which are loaded
> > with a separate find)
>
> > Fred
>
> Ohh I see, I was trying to sort friendships table, but there is no
> column last_activity_at. I guess that's it. :( or is there a way to
> re-sort the data by last_activity_at ? Cheers

The old style include that did one big join would probably do that for
you.
Just to be sure  - I'm assuming that friendships and friends are a
self referential has many though relationship (ie back to users ?)

I'd write the above query like this:
u = User.find_by_username ...
u.friendships.find :all, :joins => :friends, :order =>
'last_activity_at desc'

You could squish that down to one query, but you'll have to work out
how it aliases the table names (I always have to look that one up)

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: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread Frederick Cheung



On Dec 1, 10:35 am, "balaji rajagopal" <[EMAIL PROTECTED]>
wrote:
> Hi
>    My Resortclass application is
> Field =>id: resortclass
> Value=>1:a
>             2:b        in store in resortclasses table
>
> My Resortbasic application is
> Field =>id: resortclassid
> Value=>1:1
>             2:1       in store in resortbasics table
> I select 2nd value is  but it is stored the id value is 1and
> I select 2nd value is  but it is stored the id value is 1
> So i doubt error in wizard controller section
>
Check again. I can assure you that resortclassid is not in params[:
resortclassid] but is somewhere else.
Don't flail around blindly, use the debugger to inspect the params
hash and you'll find out soon enough (or as a poor man's alternative
use
<%= debug(params)%> in the view to display all the parameters received

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: downgrade ruby from 1.8.7 to 1.8.6 under debian

2008-12-01 Thread Anatoly Mikhailov

I have found many advices howto downgrade Ruby 1.8.7 to 1.8.6 as 
recommended by Rails core team.
You can found the article
http://railsgeek.com/2008/11/27/ubuntu-8-10-downgrade-ruby-1-8-7-to-1-8-6


ChandleWEi wrote:
> downgrade ruby from 1.8.7 to 1.8.6
> 
> http://snapshot.debian.net/archive/2008/03/22/debian/pool/main/r/ruby1.8/
> 
> download follow package and dpkg -i install all debian package
> 
> irb1.8_1.8.6.114-2_all.deb
> libopenssl-ruby1.8_1.8.6.114-2_i386.deb
> libreadline-ruby1.8_1.8.6.114-2_i386.deb
> libruby1.8_1.8.6.114-2_i386.deb
> rdoc1.8_1.8.6.114-2_all.deb
> ri1.8_1.8.6.114-2_all.deb
> ruby1.8_1.8.6.114-2_i386.deb
> ruby1.8-dev_1.8.6.114-2_i386.deb
> 
> Warning, replace "i386.deb" to your arc like "amd64.deb" or other
> 
> finally
> look
> http://dev.hubiquity.fr/2008/6/3/avoid-rails-troubles-with-ruby-1-8-7-under-debian
> 
> you will need to add these few lines into your /etc/apt/preferences to
> hole your ruby version:
> 
> Package: ruby1.8 irb1.8 rdoc1.8 ri1.8 libruby1.8 libreadline-ruby1.8 
> libopenssl-ruby1.8 ruby1.8-dev
> Pin: version 1.8.6*
> Pin-Priority: 1001

-- 
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] Sending mail templates to a mailinglist

2008-12-01 Thread Dave Smith


As a noob to rails I am struggling with being able to send a mail
template (html) stored in my database to all the users on a mailing
list. I can use the emailer page to send the mail template to a single
email address, but I want to be able to put a button on the mailinglists
show page that sends the mail template to all the mailings in the
mailinglist. The code is below for the key sections I am using.

I have been trying to figure out a solution for 4 days now and still
cannot get anything working and am loosing the will to live!!

Please if anyone could help me on this one I would be very very
greatfull.

Regards,

David


emailer controller
---

class Admin::EmailerController < Admin::AdminController
   def sendmail
  email = params[:email]
  recipient = email["recipient"]
  subject = email["subject"]
  message = email["message"]
  Emailer.deliver_contact(recipient, subject, message)
  return if request.xhr?
  render :text => 'Message sent successfully'
   end

   #def index
#  render :file => 'app\views\admin\emailer\index.html.erb'
   #end

end

--

emailer index.html.erb
---

Send Email

<% form_tag :action => "sendmail" do %>

Subject:
<%= text_field 'email', 'subject' %>


Recipient:
<%= text_field 'email', 'recipient' %>


Message
<%= text_area 'email', 'message' %>

<%= submit_tag "sendmail" %>
<% end %>
-

mailinglists show.html.erb - using the mail_template
-
Mail Template(s) in use:
<% for mail_template in @mailinglist_templates %>
<%= link_to "#{mail_template.name}",
admin_mail_template_path(mail_template), :class => 'websnapr' %>
<%= link_to 'Edit', edit_admin_mail_template_path(mail_template) %>


  <% end %>


 Subscriber List
<% for mailing in @mailinglist_mailings %>
<%= mailing.email_address %>
<% end %>

--

oh and here is my mailer model


class Admin::Emailer < ActionMailer::Base
def contact(recipient, subject, message, sent_at = Time.now)
  @subject = subject
  @recipients = recipient
  @from = '[EMAIL PROTECTED]'
  @sent_on = sent_at
  @content_type = "text/html"
  @body["title"] = 'This is title'
@body["email"] = '[EMAIL PROTECTED]'
 @body["message"] = message
  @headers = {}
   end
end
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread balaji rajagopal
Hi
   My Resortclass application is
Field =>id: resortclass
Value=>1:a
2:bin store in resortclasses table


My Resortbasic application is
Field =>id: resortclassid
Value=>1:1
2:1   in store in resortbasics table
I select 2nd value is  but it is stored the id value is 1and
I select 2nd value is  but it is stored the id value is 1
So i doubt error in wizard controller section

@resort_basic.resortclassid=params[:resortclass];

 Please check and help me sir


Thanks ®ards
Balaji

On 12/1/08, Frederick Cheung <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On 1 Dec 2008, at 09:18, bala <[EMAIL PROTECTED]> wrote:
>
> >
>
> Check your logs to see what params are being submitted. Those combo
> boxes will be in there, just not where you expect them
>
> Fred
> >
> > Hi.
> > I am new in ruby on rails..
> >
> > Im using Two tables. one is Resortclass and another is Resortbasic.
> >
> > Resortclass table using masterpage.View
> > 
> > Resort Classes
> > 
> >
> > 
> >  
> >
> >  
> >  
> >  
> >  
> >  
> >    
> >
> >  
> >  
> >  
> >  
> >  
> >    
> >
> >  
> >    
> ><%= paginating_links(@resort_classes) %>
> >   
> >
> > 
> > 
> > 
> >  
> >Resort Class
> >Action
> >  
> >  
> > <% @resort_classes.each do |resort_class| %>
> >  
> ><%=h resort_class.resortclass %>
> >
> >  <%= link_to 'Show', resort_class %>
> >  <%= link_to 'Edit', edit_resort_class_path
> > (resort_class) %>
> >   <%= link_to 'Destroy', resort_class, :confirm
> > => 'Are you sure?', :method => :delete %>
> >  
> >  
> > <% end %>
> >
> > 
> > 
> > 
> >  
> > 
> >  <%= button_to 'Add', new_resort_class_path,:class=>'myButton'%>
> > 
> >  
> > 
> >
> >
> >
> > Resortclass is working and i need to the corresponding resortid value
> > and Im using five form and different tables and one controller is
> > Wizard controller
> >
> >
> >
> >
> > Resortbasic View Page
> >
> >
> >
> >
> > <% form_tag :action => 'wizard', :stage => @next_stage do %>
> >
> > 
> >   Add Resort Basic
> > 
> >
> >
> >   Resort Name
> >
> >
> >
> ><%= text_field_tag :resortname %>
> >
> >
> >
> >
> >
> >   Resort Type
> >   
> >   
> >
> >   
> >   <%=select("resorttype", "resorttypeid", ResortType.find
> > (:all).collect {|p| [ p.resorttype, p.id ] })%>
> >   
> >
> >
> >
> >
> >   Resort Class
> >   
> >   
> >   
> >   <%=select("resortclass", "resortclassid", ResortClass.find
> > (:all).collect {|p| [ p.resortclass, p.id ] })%>
> >   
> >
> >
> >
> >   Season
> >   
> >   
> >   
> >   <%=select("seasontype", "seasontypeid", Season.find
> > (:all).collect {|p| [ p.seasontype, p.id ] })%>
> >   
> >
> >
> >
> >   Website
> >   
> >   
> >   <%= text_field_tag :website %>
> >   
> >
> > 
> > 
> >
> >
> >   
> >
> ><%= submit_tag "Next",:class =>'myButton' %>
> > 
> >
> >
> > 
> >  <% end %>
> >
> >
> > Wizard controller
> >
> > class WizardController < ApplicationController
> >
> >  def wizard
> >  if params[:stage].nil?
> >  @stage = 1
> >  @resort_basic = ResortBasic.new {}
> >
> >
> > @resort_basic.resortclassid=params[:resortclass];
> >
> > @resort_basic.resortname=params[:resortname];
> >
> > @resort_basic.resorttypeid=params[:resorttype];
> >
> > @resort_basic.seasonid=params[:seasontype];
> >
> > @resort_basic.website=params[:website];
> >
> > @resort_basic.save()
> >
> >  session[:resort_basicObj] = @resort_basic   # Or whatever model
> > is storing your stuff
> >
> >else
> >
> >  @stage = params[:stage].to_i
> >  @dummyObj = session[:resort_basicObj];
> >
> >  @dummyObj.save()
> >
> >
> > @resort_contactdetail = ResortContactdetail.new{}
> >
> > @[EMAIL PROTECTED]
> >
> > @resort_contactdetail.firstname= params[:firstname]
> > @resort_contactdetail.lastname= params[:lastname]
> > @resort_contactdetail.designation= params[:designation]
> > @resort_contactdetail.email_id= params[:email_id]
> > @resort_contactdetail.mobile= params[:mobile]
> > @resort_contactdetail.telephone1= params[:telephone1]
> > @resort_contactdetail.telephone2= params[:telephone2]
> > @resort_contactdetail.fax= params[:fax]
> >
> > #  @resort_contactdetail.save()
> >
> >end
> >
> >@next_stage = @stage + 1
> >
> >[EMAIL PROTECTED] = session[:wizard_data]
> >
> > render :template => 'wizard\\stage'[EMAIL PROTECTED]
> >  end
> > end
> >
> >
> >
> > But i got the resortname and website value and i didn't get
> > resortclassid,resorttypeid value.
> >
> > To store the  combo box id value from one table another table in m

[Rails] Re: valid? is not working in Rails 2.2.2

2008-12-01 Thread Conrad Taylor
On Mon, Dec 1, 2008 at 1:56 AM, Vipin Vm
<[EMAIL PROTECTED]>wrote:

>
> Hi Rick
>
> when i commented the following line, it worked fine.
>
> validates_presence_of :user_name, :password, :email, :display_name
>
> then what could be wrong?
>
> Vipin
>
>
Hey Vipin, are you using the same application code for both Rails 2.0.2 and
2.2.2
execution of your tests.  If so, did you update the configuration files when
executing your application code against Rails 2.2.2?

-Conrad

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

2008-12-01 Thread Pål Bergström

Robert Walker wrote:
> Pål Bergström wrote:

> Yes. Git's entire repository in inside the .git directory. If you want 
> to be safe about it just clone your repository and remove the .git 
> directory from the clone. That way if you decide you really wanted tat 
> history you'll have it in the original repository.

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: To store the combo box id value from one table another table in database+rails

2008-12-01 Thread Frederick Cheung



On 1 Dec 2008, at 09:18, bala <[EMAIL PROTECTED]> wrote:

>

Check your logs to see what params are being submitted. Those combo  
boxes will be in there, just not where you expect them

Fred
>
> Hi.
> I am new in ruby on rails..
>
> Im using Two tables. one is Resortclass and another is Resortbasic.
>
> Resortclass table using masterpage.View
> 
> Resort Classes
> 
>
> 
>  
>
>   
>   
>   
>   
>   
>    
>
>   
>   
>   
>   
>   
>    
>
>   
>    
><%= paginating_links(@resort_classes) %>
>   
>
> 
> 
> 
>  
>Resort Class
>Action
>  
>  
> <% @resort_classes.each do |resort_class| %>
>  
><%=h resort_class.resortclass %>
>
>  <%= link_to 'Show', resort_class %>
>  <%= link_to 'Edit', edit_resort_class_path
> (resort_class) %>
>   <%= link_to 'Destroy', resort_class, :confirm
> => 'Are you sure?', :method => :delete %>
>  
>  
> <% end %>
>
> 
> 
> 
>  
> 
>  <%= button_to 'Add', new_resort_class_path,:class=>'myButton'%>
> 
>  
> 
>
>
>
> Resortclass is working and i need to the corresponding resortid value
> and Im using five form and different tables and one controller is
> Wizard controller
>
>
>
>
> Resortbasic View Page
>
>
>
>
> <% form_tag :action => 'wizard', :stage => @next_stage do %>
>
> 
>   Add Resort Basic
> 
>
>
>   Resort Name
>
>
>
><%= text_field_tag :resortname %>
>
>
>
>
>
>   Resort Type
>   
>   
>
>   
>   <%=select("resorttype", "resorttypeid", ResortType.find
> (:all).collect {|p| [ p.resorttype, p.id ] })%>
>   
>
>
>
>
>   Resort Class
>   
>   
>   
>   <%=select("resortclass", "resortclassid", ResortClass.find
> (:all).collect {|p| [ p.resortclass, p.id ] })%>
>   
>
>
>
>   Season
>   
>   
>   
>   <%=select("seasontype", "seasontypeid", Season.find
> (:all).collect {|p| [ p.seasontype, p.id ] })%>
>   
>
>
>
>   Website
>   
>   
>   <%= text_field_tag :website %>
>   
>
> 
> 
>
>
>   
>
><%= submit_tag "Next",:class =>'myButton' %>
> 
>
>
> 
>  <% end %>
>
>
> Wizard controller
>
> class WizardController < ApplicationController
>
>  def wizard
>  if params[:stage].nil?
>  @stage = 1
>  @resort_basic = ResortBasic.new {}
>
>
> @resort_basic.resortclassid=params[:resortclass];
>
> @resort_basic.resortname=params[:resortname];
>
> @resort_basic.resorttypeid=params[:resorttype];
>
> @resort_basic.seasonid=params[:seasontype];
>
> @resort_basic.website=params[:website];
>
> @resort_basic.save()
>
>  session[:resort_basicObj] = @resort_basic   # Or whatever model
> is storing your stuff
>
>else
>
>  @stage = params[:stage].to_i
>  @dummyObj = session[:resort_basicObj];
>
>  @dummyObj.save()
>
>
> @resort_contactdetail = ResortContactdetail.new{}
>
> @[EMAIL PROTECTED]
>
> @resort_contactdetail.firstname= params[:firstname]
> @resort_contactdetail.lastname= params[:lastname]
> @resort_contactdetail.designation= params[:designation]
> @resort_contactdetail.email_id= params[:email_id]
> @resort_contactdetail.mobile= params[:mobile]
> @resort_contactdetail.telephone1= params[:telephone1]
> @resort_contactdetail.telephone2= params[:telephone2]
> @resort_contactdetail.fax= params[:fax]
>
> #  @resort_contactdetail.save()
>
>end
>
>@next_stage = @stage + 1
>
>[EMAIL PROTECTED] = session[:wizard_data]
>
> render :template => 'wizard\\stage'[EMAIL PROTECTED]
>  end
> end
>
>
>
> But i got the resortname and website value and i didn't get
> resortclassid,resorttypeid value.
>
> To store the  combo box id value from one table another table in mysql
> database+ruby on rails
> Please help me...
>
> Thanks &Regards
> Balaji
>
> >

--~--~-~--~~~---~--~~
You received 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: valid? is not working in Rails 2.2.2

2008-12-01 Thread Vipin Vm

Hi Rick

when i commented the following line, it worked fine.

validates_presence_of :user_name, :password, :email, :display_name

then what could be wrong?

Vipin


-- 
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: find query

2008-12-01 Thread Petr Bobek

> That sort would have ordered the users (from the 'main' find) by
> descending last_activity_at, not the associations (which are loaded
> with a separate find)
> 
> Fred

Ohh I see, I was trying to sort friendships table, but there is no 
column last_activity_at. I guess that's it. :( or is there a way to 
re-sort the data by last_activity_at ? Cheers
-- 
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] To store the combo box id value from one table another table in database+rails

2008-12-01 Thread bala


Hi.
 I am new in ruby on rails..

Im using Two tables. one is Resortclass and another is Resortbasic.

Resortclass table using masterpage.View
 
 Resort Classes


 
  
 

 

 

<%= paginating_links(@resort_classes) %>
   




  
Resort Class
Action
  
  
<% @resort_classes.each do |resort_class| %>
  
<%=h resort_class.resortclass %>

  <%= link_to 'Show', resort_class %>
  <%= link_to 'Edit', edit_resort_class_path
(resort_class) %>
   <%= link_to 'Destroy', resort_class, :confirm
=> 'Are you sure?', :method => :delete %>
  
  
<% end %>




  
 
  <%= button_to 'Add', new_resort_class_path,:class=>'myButton'%>
 
  




Resortclass is working and i need to the corresponding resortid value
and Im using five form and different tables and one controller is
Wizard controller




Resortbasic View Page




<% form_tag :action => 'wizard', :stage => @next_stage do %>

 
   Add Resort Basic
 


   Resort Name



<%= text_field_tag :resortname %>





   Resort Type
   
   

   
   <%=select("resorttype", "resorttypeid", ResortType.find
(:all).collect {|p| [ p.resorttype, p.id ] })%>
   




   Resort Class
   
   
   
   <%=select("resortclass", "resortclassid", ResortClass.find
(:all).collect {|p| [ p.resortclass, p.id ] })%>
   



   Season
   
   
   
   <%=select("seasontype", "seasontypeid", Season.find
(:all).collect {|p| [ p.seasontype, p.id ] })%>
   



   Website
   
   
   <%= text_field_tag :website %>
   

 
 


   

<%= submit_tag "Next",:class =>'myButton' %>
 


 
  <% end %>


Wizard controller

 class WizardController < ApplicationController

  def wizard
  if params[:stage].nil?
  @stage = 1
  @resort_basic = ResortBasic.new {}


 @resort_basic.resortclassid=params[:resortclass];

 @resort_basic.resortname=params[:resortname];

 @resort_basic.resorttypeid=params[:resorttype];

 @resort_basic.seasonid=params[:seasontype];

 @resort_basic.website=params[:website];

 @resort_basic.save()

  session[:resort_basicObj] = @resort_basic   # Or whatever model
is storing your stuff

else

  @stage = params[:stage].to_i
  @dummyObj = session[:resort_basicObj];

  @dummyObj.save()


 @resort_contactdetail = ResortContactdetail.new{}

 @[EMAIL PROTECTED]

 @resort_contactdetail.firstname= params[:firstname]
 @resort_contactdetail.lastname= params[:lastname]
 @resort_contactdetail.designation= params[:designation]
 @resort_contactdetail.email_id= params[:email_id]
 @resort_contactdetail.mobile= params[:mobile]
 @resort_contactdetail.telephone1= params[:telephone1]
 @resort_contactdetail.telephone2= params[:telephone2]
 @resort_contactdetail.fax= params[:fax]

 #  @resort_contactdetail.save()

end

@next_stage = @stage + 1

[EMAIL PROTECTED] = session[:wizard_data]

 render :template => 'wizard\\stage'[EMAIL PROTECTED]
  end
end



 But i got the resortname and website value and i didn't get
resortclassid,resorttypeid value.

To store the  combo box id value from one table another table in mysql
database+ruby on rails
Please help me...

Thanks &Regards
Balaji

--~--~-~--~~~---~--~~
You received 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] acts_as_versioned and rails 2.2.2

2008-12-01 Thread Emuen

Hi people I have tried to install the acts_as_versioned gem from
github in rails 2.2.2 but it seems to conflict with some methods in
the activerecords dirty.rb-file. I can solve some of the problem by
changing code in the activerecord, but I don't think that was the
intention.

--~--~-~--~~~---~--~~
You received 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: find query

2008-12-01 Thread Frederick Cheung


On 1 Dec 2008, at 08:48, Petr Bobek wrote:

>
> Hi,
>
> I have user table (last_activity, last_activity_at, ) and
> friendships table (many to many).
> What I am trying to do is to show to the user the last actions of
> his/her friends.
>
> [EMAIL PROTECTED] = User.find_by_username(username, :order =>
> 'last_activity_at DESC', :include => [:friendships => :friend])[/code]
>
> [code]<%= render :partial => 'friends_activity', :collection =>
> @activities.friendships %>[/code]
>
> But the descending ordering is not working :( What I am missing here?
> Cheers, Pete

That sort would have ordered the users (from the 'main' find) by  
descending last_activity_at, not the associations (which are loaded  
with a separate find)

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] Can't restart memcached anymore

2008-12-01 Thread Justus Ohlhaver

Hi,

My memcached has been working perfectly.

But all of a sudden I am not able to restart it anymore
(RAILS_ENV=production rake memcached:start),

getting this error message:


failed to set rlimit for open files. Try running as root or requesting
smaller maxconns value.


This has never happened before.

Does anyone know where and how to request a 'smaller maxconns value'?

(Running root doesn't help me. It tells me 'can't run as root without
the -u switch'... not sure what that means. Running the sudo rake task
with '-u' shows no result at all..)

Thanks a lot for any help!
Justus
-- 
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] find query

2008-12-01 Thread Petr Bobek

Hi,

I have user table (last_activity, last_activity_at, ) and
friendships table (many to many).
What I am trying to do is to show to the user the last actions of
his/her friends.

[EMAIL PROTECTED] = User.find_by_username(username, :order =>
'last_activity_at DESC', :include => [:friendships => :friend])[/code]

[code]<%= render :partial => 'friends_activity', :collection =>
@activities.friendships %>[/code]

But the descending ordering is not working :( What I am missing here?
Cheers, Pete
-- 
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
-~--~~~~--~~--~--~---



  1   2   >