[Rails] Re: Editing "Tutorials"

2009-09-26 Thread Joe

Right.. Just maybe figured out another bit of it. I changed:

<% form_for(@tutorial_category, @tutorial) do |f| %>

to

<% form_for(@tutorial.category, @tutorial) do |f| %>

and this seems to function properly, however now I have a new issue
that ive been working on for hours and still cant figure out how to
fix.
In the form the category part of it is like this:

<%= f.label :category_id %>
<%= f.text_field :category_id %>

The first label line works fine but I get this error for the next
line:

undefined method `category_id' for #

(or something like that)


Ive tried every possible combination I can think of with changing
category_id all the way to things like tutorial.category_id and
allsorts.

So this is the first error I cant solve, so i decided to try without
it and see if the other features work, well :name  seems to work fine,
but the next bit (:content) dosn't work.

At the moment its like this:

<%= f.label :content %>
<%= f.text_area :content %>

once again I get the error for the second of the two lines.

And this is my second problem that I cant fix, I havnt tried
without :content and without :category_id yet so im not sure if the
update button works, but I tink these problems should be dealt with
first.


Regards,

and Thanks In Advance,



Joe

On Sep 26, 6:52 pm, Joe  wrote:
> Strangely.. I acctually figured out what was wrong and corrected to:
> edit_category_tutorial_path(@tutorial_category.id, @tutorial)
>
> which seems to lead to the edit page. However I now have an issue on
> this page, as the form as it was (  <% form_for(@tutorial) do |f| %> )
> gives the error:
>
> undefined method `tutorial_path'
>
> So I decided logically to change it to:   <% form_for
> (@tutorial_category.id, @tutorial) do |f| %>
>
> which gave a fixnum error, which I read was because I used  ".id"
> which is a fixed integer so i changed it to:
>
> <% form_for(@tutorial_category, @tutorial) do |f| %>
>
> which now gives me the error I cant solve:
>
> undefined method `nil_class_path' for #
>
> (or something of those origins)
>
> Please Help me solve this issue, and sorry for my permanent bumping
> and this time I shall wait until I decide to bump (if I decide to bump
> atall)
>
> Thanks In Advance,
>
> Joe
>
> On Sep 26, 5:33 pm, Joe  wrote:
>
> > Yes correct I am desperate rather often as I was supposed to only take
> > my site down for a few says to do this and it hs extended onto weeks.
>
> > I will read the link (although im so bas in RoR im not honestly sure
> > if i'll understand it),
>
> > If anyone wants to give a more direct answer please feel free to do
> > so, as the chances are I havnt been able to figure it out.
>
> > Regards,
>
> > Joe
>
> > On Sep 26, 3:01 pm, richardun  wrote:
>
> > > Marnen is right.  You're not going to get far with people's help most
> > > places if you don't take the minimal effort to be courteous (or at
> > > least stop using "Soz").
>
> > > You seem to be desperate rather often (http://groups.google.com/group/
> > > rubyonrails-talk/browse_thread/thread/
> > > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need
> > > to bump before 24 hours.
>
> > > I will tell you, there is a way to evaluate / display the path you're
> > > trying to use using script/console.  You should also read 
> > > this:http://api.rubyonrails.org/classes/ActionController/Routing.html
>
> > > R
>
> > > On Sep 26, 7:05 am, Joe  wrote:
>
> > > > Any1??
>
> > > > (Soz for bump, im just RLLY desperate to fix)
>
> > > > On Sep 25, 6:02 pm, Joe  wrote:
>
> > > > > Then I get this error on the tutorial show page:
>
> > > > > edit_category_tutorial_url failed to generate from
> > > > > {:action=>"edit", :controller=>"tutorials", :category_id=># > > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the
> > > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at:
> > > > > "2009-09-21 15:55:54">}, expected:
> > > > > {:action=>"edit", :controller=>"tutorials"}, diff:
> > > > > {:category_id=># > > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21
> > > > > 15:55:54", updated_at: "2009-09-21 15:55:54">}
>
> > > > > On Sep 25, 9:11 am, bill walton  wrote:
>
> > > > > > Hi Joe,
>
> > > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:
> > > > > > > edit_category GET /categories/:id/edit(.:format)
> > > > > > > edit_category_tutorial GET  
> > > > > > > /categories/:category_id/tutorials/:id/edit
> > > > > > > (.:format)
>
> > > > > > > > On Sep 24, 11:09 am, Joe  wrote:
>
> > > > > > > > > <%= link_to 'Edit', edit_category_path(@category) %>
>
> > > > > > > > > but when I change this totutorials:
>
> > > > > > > > > <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> > > > > > > > > I get this error on the tutorial show page:
>
> > > > > > > > > undefined method `edit_tutorial_path' for # > > > > > > > > 0x5ce52fc>
>
> > > > > > It looks like you just need to use the correct route which, it 
> > > > > > appears,
> > > > > > is named:
>
>

[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-26 Thread Greg Hauptmann

thanks - does Rackspacecloud have Ruby on Rails support (well like
Dreamhost?), or it a get your own server & do it yourself?

2009/9/26 Tony Primerano :
>
> Agreed. Rackspace is great.   Especially when you're 1st building your
> application.  I had apache/passenger and mysql running just fine on a
> 256MB instance.  cost?  about $11/month.
>
> http://www.tonycode.com/blog/archives/122
>
> There is EC2 on Rails but AWS starts at about $90/month.  I'm really
> happy with rackspace.
>
> On Sep 25, 6:18 pm, Greg Donald  wrote:
>> On Fri, Sep 25, 2009 at 4:43 PM, Greg Hauptmann
>>
>>  wrote:
>>
>> > any pointers / suggestions re cheapest Rails hosting where they give
>> > you full access to Apache (to load modules etc)???  Can be a shared
>> > platform, however not sure if there is a shared platform type hosting
>> > service where they do give you such access?
>>
>> Cloud hosting is probably the cheapest you'll find where you have root
>> access.  I'm using Rackspace Cloud.
>>
>> http://www.rackspacecloud.com/
>>
>> --
>> Greg Donaldhttp://destiney.com/
> >
>



-- 
Greg
http://blog.gregnet.org/

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



[Rails] Re: cost model for a RoR where users could upload lots of file? what approach?

2009-09-26 Thread Greg Hauptmann

so you still use one the well known rails hosts sites for your actual
Rails app then James, but just use www.unlimitedwebhosting.co.uk for
images etc right?  then you just use the rails
"config.action_controller.asset_host" concept (which was in the blog)
to handle users browsers picking up images directly from
www.unlimitedwebhosting.co.uk?

2009/9/26 James West :
>
> Greg Hauptmann wrote:
>> Hi,
>>
>> Any ideas/suggestions re what a good cost model / approach would be if
>> one's Ruby on Rails application was to be successful, but noting users
>> (as part of the service/application) could upload lots of files
>> (images etc).
>>
>> What's a good way of have:
>>   (a) a simple cost model for use of the site, e.g. free up to X but
>> costs Y after this per every Z,
>>   (b) noting files/images etc have to be protected by the rails
>> authentication / authorization
>>   (c) makes sure I won't start losing money (e.g. if users have to pay
>> less than the cost of storage / bandwidth)
>>
>> Any good ideas/approaches?
>>
>> Thanks
>
> Use an external repository for your images that has unlimited bandwidth
> unlimited drivespace and an acceptable uptime that charges a fixed cost
> per month.
> www.unlimitedwebhosting.co.uk is the what I use for image and doc
> hosting.
> This approach will massively improve performance of any Rails site that
> serves static data and is extremely simple to implement by making use of
> asset_host.
>
> Check out this blog
> http://ariejan.net/2007/09/24/rails-20-new-features/
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



-- 
Greg
http://blog.gregnet.org/

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



[Rails] Re: Heroku

2009-09-26 Thread Marnen Laibow-Koser

Steve Ross wrote:
> On Sep 26, 2009, at 3:56 AM, Nicolai Constantin Reuschling wrote:
> 
>>
>> So you are really asking the Rails mailing list for help with a tool
>> interfacing with a service provider?
>>
>> Nicolai
> 
> I think the OP asked a fair question. People ask about deploying on
> Dreamhost or [insert host name here] all the time on this list. Why
> not Heroku?

Because the Dreamhost deployment questions are generally asking about 
how to configure Rails to work around some technical limitation on the 
host.  This question is different.  It has not a whit to do with any 
Rails issue.  It belongs on Heroku's support forum or on the Git list, 
not here.

> 
> To the OP: More information would be helpful. Like what doesn't work?
> Have you checked out their support section and uploaded your public key?

This is not the place to support Git integration with Heroku.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Marnen Laibow-Koser

Greg Christopher wrote:
> Yeah, i was using my buddy's computer.
> 
> So, I think I understand, but want to make sure I understand how I would 
> use these practically.  Basically, using these ruby shortcuts allows me 
> to better work with and manage variables that I won't immediately be 
> saving with my object.

At this point, you should probably read Programming Ruby (or a similar 
book) and get a good understanding of accessor methods.  There's little 
or nothing Rails-specific in this discussion, and we are far enough 
toward the "Ruby basics" end of the spectrum that it will be a better 
use of everyone's time and brain power if you come back after you do a 
bit of reading.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Greg Christopher

Yeah, i was using my buddy's computer.

So, I think I understand, but want to make sure I understand how I would 
use these practically.  Basically, using these ruby shortcuts allows me 
to better work with and manage variables that I won't immediately be 
saving with my object.

For instance, in your special case, if I need to calculate the 
intersection of two shapes for the view, but didn't need to save that 
value in my DB, then I would use the setter method?

Maybe in your second example, where I'm doing nothing special, but had 
these points, I'd be using those points in a view or some other output, 
but wouldn't be returning them to be stored on a record, at least not 
immediately. Yes?

Thanks!

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

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



[Rails] Re: Heroku

2009-09-26 Thread s.ross


On Sep 26, 2009, at 3:56 AM, Nicolai Constantin Reuschling wrote:

>
> So you are really asking the Rails mailing list for help with a tool
> interfacing with a service provider?
>
> Nicolai

I think the OP asked a fair question. People ask about deploying on  
Dreamhost or [insert host name here] all the time on this list. Why  
not Heroku?

To the OP: More information would be helpful. Like what doesn't work?  
Have you checked out their support section and uploaded your public key?

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



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Colin Curtin

On Sat, Sep 26, 2009 at 9:31 PM, Colin Curtin  wrote:
> in reference to your first question - "I was wondering what methods

Er, I mean, if that was you also. I forgot to check the original
poster's name. :D

Colin

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



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Colin Curtin

On Sat, Sep 26, 2009 at 8:38 PM, Mario Gr
 wrote:
> Got it - maybe.  I found a good resource[1], but I am not sure I
> understand the value of the setter method in the first place. It would
> seem that benefit is being able to skip explicitly calling save on an
> object. Is that right?

The benefit of getter and setter methods are many - essentially they
allow you to perform operations on the variable before and after they
are retrieved or set. This is part of object-oriented methodology. But
in reference to your first question - "I was wondering what methods
ending in an equal sign meant", it is a feature of Ruby itself that
methods can end in "!", "?" and "=", and the community has taken these
to mean "potentially dangerous/exception creating", "interrogative
(should return a boolean)" and "sets a variable", respectively.

> If I had this method defined on my class:
>
>  def my_attribute=(some_value)
>   �...@some_value = some_value
>  end
>
> I could call:
>
> �...@object.my_attribute = new_value
>
> instead of:
>
> �...@object.my_attribute = new_value
> �...@object.save
>
> Is that the reason to define a setter method?

No, because in #my_attribute=, you did not call save. Here is a reason
to define a setter method:

class Shape
  def save_intersection=(shape)
@intersection = self.calculate_intersection(shape)
  end
end

That is, we need to calculate the intersection of these two shapes and
then we can store the result in an instance variable. This is a good
use of the setter syntax, because it sets a variable, and we need to
do something "special". However, if we're not doing anything special
with the variable being set, it is preferable to write:

class Shape
  attr_accessor :points
end

Which automatically defines the methods #points, which gets the
instance variable @points, and #points=, which will set the instance
variable if you used it like:

shape = Shape.new
shape.points = [1.2, 3,3]


Colin

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



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Mario Gr

Got it - maybe.  I found a good resource[1], but I am not sure I 
understand the value of the setter method in the first place. It would 
seem that benefit is being able to skip explicitly calling save on an 
object. Is that right?

If I had this method defined on my class:

  def my_attribute=(some_value)
@some_value = some_value
  end

I could call:

  @object.my_attribute = new_value

instead of:

  @object.my_attribute = new_value
  @object.save

Is that the reason to define a setter method?

[1] http://rubylearning.com/satishtalim/ruby_syntactic_sugar.html
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: SSL/HTTP with regards to Mongrel

2009-09-26 Thread Wang Pengcheng
This is my solution.
Nginx + Mongrel
Nginx can support the Https.

http://wiki.nginx.org/NginxHttpSslModule

Let nginx parser the Https request and then proxy it to Mongrel.

2009/9/27 Tom Milewski 

>
> I have been looking all over and either I can't find anything  or I
> can't find anything that works... so here I am.
>
> How can I go about setting up SSL/HTTP with regards to Mongrel?
>
> Thanks in advance!
> >
>


-- 
Code our future
Name   : Wang Pengcheng
Nick : QJGui

Sent from Wuhan, 42, China

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



[Rails] Re: Use the source, dude (was: uniqueness validation perplex

2009-09-26 Thread Marnen Laibow-Koser

Michael Schuerig wrote:
> On Saturday 26 September 2009, Dudebot wrote:
>> Oh, I definitely admit that my "docs reading skills" are imperfect!
>> Maybe in my next life I'll be granted the get-it-all-at-once-when-
>> reading gift, but not in this one :)  Anyway, you helped me cut out
>> unnecessary code and I learned quite a bit in the process, so I am
>> grateful.
> 
> Have you ever considered reading the Rails source code? Not everything,
> of course, but some of the bits and pieces that interest you and that
> give you trouble. Spent as much or as little time as you like and
> you'll find it is well spent. Reading and understanding the source is
> within the reach of every programmer seriously working with Rails.
[...]

Great advice.  I really must find the time to do more of that.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Use the source, dude (was: uniqueness validation perplexity)

2009-09-26 Thread Michael Schuerig

On Saturday 26 September 2009, Dudebot wrote:
> Oh, I definitely admit that my "docs reading skills" are imperfect!
> Maybe in my next life I'll be granted the get-it-all-at-once-when-
> reading gift, but not in this one :)  Anyway, you helped me cut out
> unnecessary code and I learned quite a bit in the process, so I am
> grateful.

Have you ever considered reading the Rails source code? Not everything, 
of course, but some of the bits and pieces that interest you and that 
give you trouble. Spent as much or as little time as you like and 
you'll find it is well spent. Reading and understanding the source is 
within the reach of every programmer seriously working with Rails. 

There are about three places that are truly involved (in the 2.x 
series): joins and associations in ActiveRecord, view templates, and 
routing. So don't start your reading at the deep end and you'll be 
fine.

I'm making this suggestion every once in a while and usually the 
reaction is not particularly heartfelt. Anyway, don't take this 
personally, see it as an invitation, not an exhortation.

Michael

-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/

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



[Rails] Re: Config XLSUITE in Windows

2009-09-26 Thread Harman Sandjaja

Hello,

Not sure if this is going to be a double post. Anyway... did you manage 
to solve this problem?

I can start XLsuite application on my Windows machine just fine. Looking 
at the trace though, I don't think it's related to XLsuite app. Can you 
boot up other Rails application just fine using your mongrel 
installation?

Here is my system information for comparison:
OS: WindowsXP Service Pack 2
Ruby: ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
Rails: 2.2.2
MySQL Server: mysql  Ver 14.12 Distrib 5.0.67, for Win32 (ia32)
Gem: 1.3.1
Mongrel: 1.1.5

The Rails version should not matter since XLsuite app has "rails" in 
/vendor and so the application loads up using this vendorized Rails.

Regards,
Harman Sandjaja

Rajesh Kumar wrote:
> I try to config XLSUITE in my system. I'm facing some problem i resolved
> it one by one.
> 
> now im facing this error
> 
> => Booting Mongrel (use 'script/server webrick' to force WEBrick)
> => Rails 2.2.0 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
> Exiting
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/tcphack.
> rb:13:in `listen': An operation on a socket could not be performed
> because the s
> ystem lacked sufficient buffer space or because a queue was full. -
> listen(2) (E
> rrno::ENOBUFS)
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/tcphack.rb:13:in `initialize'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel.rb:93:in `new'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel.rb:93:in `initialize'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:139:in `new'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:139:in `listener'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
> grel_rails:99:in `cloaker_'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:50:in `call'
> from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:50:in `initialize'
>  ... 14 levels...
> from
> C:/Rajesh/RubySamples/xlsuite/vendor/rails/railties/lib/commands/se
> rver.rb:49
> from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
> m_original_require'
> from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
> quire'
> from script/server:3
> 
> please help me to resolve it. I'm a beginner in RoR.
> 
> My System Info:
> OS: WindowsXP Service Pack 2
> Ruby: 1.8.6
> Rails: 2.3.4
> MySQL Server: 5.1

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

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



[Rails] Re: Config XLSUITE in Windows

2009-09-26 Thread hsandjaja

Hmm... I've never seen anything like that when booting up my XLsuite.
That is very weird. Did you solve this problem?

I don't think it's a problem related to XLsuite app though. Can you
boot up other Rails application just fine?

Your Rails version shouldn't matter since XLsuite has rails under /
vendor.

Here is my system info for some comparison:
OS: WindowsXP Service Pack 2
Ruby: ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
Gem: 1.3.1
MySQL: mysql  Ver 14.12 Distrib 5.0.67, for Win32 (ia32)

On Sep 26, 1:30 am, Rajesh Rajesh 
wrote:
> I try to configXLSUITEin my system. I'm facing some problem i resolved
> it one by one.
>
> now im facing this error
>
> => Booting Mongrel (use 'script/server webrick' to force WEBrick)
> => Rails 2.2.0 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
> Exiting
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/tcphack.
> rb:13:in `listen': An operation on a socket could not be performed
> because the s
> ystem lacked sufficient buffer space or because a queue was full. -
> listen(2) (E
> rrno::ENOBUFS)
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/tcphack.rb:13:in `initialize'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel.rb:93:in `new'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel.rb:93:in `initialize'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:139:in `new'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:139:in `listener'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
> grel_rails:99:in `cloaker_'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:50:in `call'
>         from
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
> grel/configurator.rb:50:in `initialize'
>          ... 14 levels...
>         from
> C:/Rajesh/RubySamples/xlsuite/vendor/rails/railties/lib/commands/se
> rver.rb:49
>         from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
> m_original_require'
>         from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
> quire'
>         from script/server:3
>
> please help me to resolve it. I'm a beginner in RoR.
>
> My System Info:
> OS: WindowsXP Service Pack 2
> Ruby: 1.8.6
> Rails: 2.3.4
> MySQL Server: 5.1
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Cleaning up test files for Paperclipped models

2009-09-26 Thread Fernando Perez

In my tests that use Paperclip some require that a file is provided, the
problem is that in the test, when the object gets saved to DB, the
associated file gets saved to disk and clutters my folders.

So what's the solution for that? The problem is the has_attached_file
method.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: removing attribute prefix from validation error messages

2009-09-26 Thread bgumbiker

THanks Richard,
Could you post any further usage example as I am quite new in Ruby and
Rails and do not understand what happening below in your code. Is :msg
an attribute in the model?
thanks,
bogumbiker

On Sep 26, 11:20 pm, richardun  wrote:
> Actually, bgumbiker, I just posted this answer yesterday so a bit more
> searching might have produced an 
> answer.http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...
>
> If you used Ranjan's answer, you'll have to enter a specific custom
> message for each validation you do.  If you use the solution I
> outlined in that URL or below, you change the "humanization" version
> of that column name so you can do validations as normal and when the
> human name is used to display an error message, it'll use the one you
> mapped.
>
> class Post < ActiveRecord::Base
>
>   HUMANIZED_COLUMNS = {:msg => "Message"}
>
>   def self.human_attribute_name(attribute)
>     HUMANIZED_COLUMNS[attribute.to_sym] || super
>   end
> end
>
> Richard
>
> On Sep 26, 5:50 am, ranjan kumar  wrote:
>
> > Try this
>
> > class User < ActiveRecord::Base
> >   validate do |user|
> >     user.errors.add_to_base("This is my custom message") if user.
> > attribute_name.blank?
> >   end
> > end
>
> > On Sat, Sep 26, 2009 at 2:52 PM, bgumbiker wrote:
>
> > > Hello,
> > > Any idea how to remove attribute name from validation error messages?
> > > thanks,
> > > bogumbiker
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What are methods ending in =?

2009-09-26 Thread Fernando Perez

Greg Christopher wrote:
> Hi,
> 
> I was wondering what methods ending in an equal sign meant, but am not
> sure what to search for?  Could anyone point me to any resources or tell
> me some terms to search for.
> 
> Thanks!
> 
> -Greg

It's sugar syntax!

So the method assign=(user_id), can be written in ruby: @object.assign = 
user_id

Note the spaces around the equal sign :-)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] What are methods ending in =?

2009-09-26 Thread Greg Christopher

Hi,

I was wondering what methods ending in an equal sign meant, but am not
sure what to search for?  Could anyone point me to any resources or tell
me some terms to search for.

Thanks!

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

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



[Rails] Running Unit Tests With SphinxSE

2009-09-26 Thread MaggotChild

Several of my unit tests run queries against SphinxSE. Since Rails
creates the test DB by dumping the dev DB schema, my SphinxSE queries
aren't run against the test DB.

There seems to be no way to hook into the test:clone_structure task,
so I thought that I'll just have the appropriate unit tests include
this:

module SphinxTest
  @@index = 'ct_test_index'
  mattr_accessor :index, :host, :port

  self << class
def included(klass)
   alter_test_table unless
end

#MySQL specific
def alter_test_table
  return unless ActiveRecord::Base.connection.table_exists?
(Query::TABLE_SPHINX)

  create = ActiveRecord::Base.connection.select_value "show create
table #{Query::TABLE_SPHINX}"
  if @@index && md = create.match %r|sphinx://([-.\w]+):(\d+)?/[-
\w]+|
host = @@host || md[0]
port = @@port || md[1]

alter = %|alter table #{Query::TABLE_SPHINX}
connection="sphinx://#{host}:#{port}/#{@@index}"|
ActiveRecord::Base.connection.execute alter
  end
end
  end
end

does anyone know of way to do this from outside my unit tests?

On a side note, assuming portability was an issue, there seems to be
know way to get the TableDefinition from the connection. Is this
really the case?

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



[Rails] Re: I'm restarting to work with ruby on rails, but having configurations problems

2009-09-26 Thread Katherine

I do not follow that book although it is updated for Rails 2.0.
Make sure you have   map.resources :stories on routes,rb


On Sep 26, 1:29 pm, Delirium tremens  wrote:
> I have the Shovell source code from the book Simply Rails 2, but I'm
> having problems running it.
>
> "Getting started
> Here’s how to get rolling:
>
>    1.
>       Create your databases and edit config/database.yml
>
>       Rails needs to know your login and password.
>    2.
>       Use script/generate to create your models and controllers
>
>       To see all available options, run it without parameters.
>    3.
>       Set up a default route and remove or rename this file
>
>       Routes are set up in config/routes.rb."
>
> I took step 1, then since the models and controllers are already
> generated for a source code that already exists, I skipped step 2 and
> since a default route is already set for a source code that already
> exists, I skipped step 3.
>
> My config/roubes.rb has map.root :controller => "stories", 
> buthttp://localhost:3000/still doesn't load the stories controller
> index. Why?

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



[Rails] Re: Find the gems and plugins used in Rails Application

2009-09-26 Thread Fernando Perez

> @xiexie11: i dont want only to see the gems used from the app, i want
> to know how to make them available when i transfer the app to another
> computer
> 
> Thanx

If one of your gem is compiled, then you'll run in troubles if the 
target computer is not the same as the source computer.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Find the gems and plugins used in Rails Application

2009-09-26 Thread louposk

@Litwin: if i specify the gems in the environment.rb file, when i
transfer the application
and run gems:install all these gems will install automatically to the
machine??
Thanx

@xiexie11: i dont want only to see the gems used from the app, i want
to know how to make them available when i transfer the app to another
computer

Thanx

On Sep 23, 6:59 pm, xiexie11  wrote:
> If you just want to see what your app is using and you haven't used
> config gem with the versions set, you can use the console and run:
>
> Rails.configuration.gems.sort{|a,b| a.specification.name <=>
> b.specification.name}.collect{|g| "#{g.specification.name} - #
> {g.specification.version}"}
>
> On Sep 18, 9:28 am, "Kostas L."  wrote:
>
>
>
> > Is there a way to see only the gems and plugins used in my app not the
> > gems i see when i run e.g gem-list command???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Does << create a new record?

2009-09-26 Thread Fernando Perez


> Yes, it will save the item (assuming Order has many Items, Item
> belongs to Order). If it doesn't, something else is wrong (like the
> item not being valid).
Nice catch, one of my items was not valid.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Does << create a new record?

2009-09-26 Thread David A. Black

Hi --

On Sat, 26 Sep 2009, Fernando Perez wrote:

>
> Search engine don't index << so it's hard to find info about it.
>
> Let's say I have:
>
> order = order.create
> item = Item.new
>
> Will order.items << item create a new entry for the item in DB or not?
> I'm having issues.

Yes, it will save the item (assuming Order has many Items, Item
belongs to Order). If it doesn't, something else is wrong (like the
item not being valid).


David

-- 
David A. Black, Director
Ruby Power and Light, LLC (http://www.rubypal.com)
Ruby/Rails training, consulting, mentoring, code review
Book: The Well-Grounded Rubyist (http://www.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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: cost model for a RoR where users could upload lots of file? what approach?

2009-09-26 Thread James West

Greg Hauptmann wrote:
> Hi,
> 
> Any ideas/suggestions re what a good cost model / approach would be if
> one's Ruby on Rails application was to be successful, but noting users
> (as part of the service/application) could upload lots of files
> (images etc).
> 
> What's a good way of have:
>   (a) a simple cost model for use of the site, e.g. free up to X but
> costs Y after this per every Z,
>   (b) noting files/images etc have to be protected by the rails
> authentication / authorization
>   (c) makes sure I won't start losing money (e.g. if users have to pay
> less than the cost of storage / bandwidth)
> 
> Any good ideas/approaches?
> 
> Thanks

Use an external repository for your images that has unlimited bandwidth 
unlimited drivespace and an acceptable uptime that charges a fixed cost 
per month.
www.unlimitedwebhosting.co.uk is the what I use for image and doc 
hosting.
This approach will massively improve performance of any Rails site that 
serves static data and is extremely simple to implement by making use of 
asset_host.

Check out this blog
http://ariejan.net/2007/09/24/rails-20-new-features/
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] To protect or not email attribute of user

2009-09-26 Thread Fernando Perez

Hi,

What's your best practice about the email attribute of a registered user
in your DB. I don't want people to be able to change email.

But what's best?

1) protect the email attribute with attr_protected or attr_accessible
and suffer the pain of having to do user.email =  everywhere in your
code and tests

2) Keep email accessible, but write a custom update_attributes that
filters the email attribute?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Does << create a new record?

2009-09-26 Thread Fernando Perez

Search engine don't index << so it's hard to find info about it.

Let's say I have:

order = order.create
item = Item.new

Will order.items << item create a new entry for the item in DB or not?
I'm having issues.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: removing attribute prefix from validation error messages

2009-09-26 Thread richardun

Actually, bgumbiker, I just posted this answer yesterday so a bit more
searching might have produced an answer.
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/cf59e09f98981f27/6c7fe5ff9dd016bc?lnk=gst&q=customize+active+record+attribute+display+name+in+error+message#6c7fe5ff9dd016bc

If you used Ranjan's answer, you'll have to enter a specific custom
message for each validation you do.  If you use the solution I
outlined in that URL or below, you change the "humanization" version
of that column name so you can do validations as normal and when the
human name is used to display an error message, it'll use the one you
mapped.

class Post < ActiveRecord::Base

  HUMANIZED_COLUMNS = {:msg => "Message"}

  def self.human_attribute_name(attribute)
HUMANIZED_COLUMNS[attribute.to_sym] || super
  end
end

Richard

On Sep 26, 5:50 am, ranjan kumar  wrote:
> Try this
>
> class User < ActiveRecord::Base
>   validate do |user|
>     user.errors.add_to_base("This is my custom message") if user.
> attribute_name.blank?
>   end
> end
>
> On Sat, Sep 26, 2009 at 2:52 PM, bgumbiker wrote:
>
>
>
> > Hello,
> > Any idea how to remove attribute name from validation error messages?
> > thanks,
> > bogumbiker
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-26 Thread James West

Greg Hauptmann wrote:
> any pointers / suggestions re cheapest Rails hosting where they give
> you full access to Apache (to load modules etc)???  Can be a shared
> platform, however not sure if there is a shared platform type hosting
> service where they do give you such access?

Having tried a lot of Rails hosts I kinda stumbled over 
http://railsplayground.com
The proce was cheap enough ($5) to be worth trying it out.
...
6 months later I now have a VPS and am considering a dedicated server.

These guys are truly amazing and leave the offerings from dreamhost and 
all floundering in their wake.

There technical support is truly amazing via tickets and online 24/7 
live chat.
They focus on Rails only and do not oversell their resources unlike some 
hosts that have been mentioned in this thread.

I can not recommend Railsplayground strongly enough.

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

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



[Rails] Paperclip with external url and asset_host?

2009-09-26 Thread James West

Hi,
I'm trying to get Paperclip to work with asset_host and have totally
failed to do so.

The idea is to use asset_host to specify the url that I want to use for
my image hosting (www.unlimitedwebhosting.co.uk) so that link helpers
will use the image host location instead of the local file system.

This works really well and in truth I'm totaly blown away by the power
and simplicity of Rails but for the life of me I can't get Paperclip to
play ball.

Having delved a little into the Paperclip source (scary!) I find that
the File class is used to do the io streaming and I've kinda got an
incling that I might be able to make use of this knowledge somehow but I
really need a pointer as to how to proceed with this.

I notice that there is an S3 option and also wondered if that could be
adapted to be used to in some way?

Any ideas would be greatly appreciated

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

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



[Rails] Re: dynamic form problem

2009-09-26 Thread Marnen Laibow-Koser

Greg Donald wrote:
> On Fri, Sep 25, 2009 at 4:37 PM, Jedrin  wrote:
>> try. Having empty   tags in the
> 
> Empty tags is invalid HTML.  

No it's not.  Check with the W3C validator.  It has no problem with


> Use a non-breaking space   or
> something similar to make it valid.

That's no more or less valid than an empty container.  But it does have 
different semantics, which the OP may or may not want.

> 
>  

Well, that's not valid by itself...

> 
> 
> --
> Greg Donald
> http://destiney.com/

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] SSL/HTTP with regards to Mongrel

2009-09-26 Thread Tom Milewski

I have been looking all over and either I can't find anything  or I
can't find anything that works... so here I am.

How can I go about setting up SSL/HTTP with regards to Mongrel?

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



[Rails] Re: cms like routes

2009-09-26 Thread fredd

I think I solved it my self actually!

It turns out that if you name the id parameter something else (like
article_id) Rails actually divides the params correctly.

So this route:
map.article_by_id '*sections/:article_id', :controller =>
"articles", :action => "show", :article_id => /\d|\d-(.+)/
would detect something like this:
news/sports/football/4
and Rails would route to the article controller and show action width
the following params: {"sections"=>["news", "sports", "football"],
"article_id"=>"4"}

Pretty cool, and hopefully this helps someone else with the same
problem that I had.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Cross Model Validation

2009-09-26 Thread nb

So I have this question:

Suppose I have these 3 models:

class Company < ActiveRecord::Base
  has_many :departments
  has_many :employees
end

class Department < ActiveRecord::Base
  has_many :employees
  belongs_to :company
end

class Employee < ActiveRecord::Base
  belongs_to :company
  belongs_to :department
end

Furthermore, suppose the domain I am modeling requires that I support
the existence of employees that do not belong to any department
(otherwise I would declare that Company has_many :employees, :through
=> :departments instead).

As I am working with the Department model, I am thinking that it is
conceivable that a mistake can be made in the code to allow an
employee from a company to be incorrectly assigned to a department in
another company.  Hence, it might be a good idea to write some custom
validation to ensure an employee and a department belong to the same
company before they associated together.

Since associate a department and an employee together in one of two
ways, I would need validation logic in both models.  So I am thinking
it would involve something like:

1. In the Department model

def validate
  self.errors.add(:employees, "must all belong to same company") if
self.employees.collect { |e| e.company_id }.uniq.length > 1
end

2 In the Employee model:

def validate
  self.errors.add(:department, "must belong to the same company") if
self.department && self.department != self.company
end

However, having to write two separate methods to support a single
business rule feels not so DRY or elegant.  Is there a better way to
go?

Thanks!

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



[Rails] Re: uniqueness validation perplexity

2009-09-26 Thread Dudebot

Oh, I definitely admit that my "docs reading skills" are imperfect!
Maybe in my next life I'll be granted the get-it-all-at-once-when-
reading gift, but not in this one :)  Anyway, you helped me cut out
unnecessary code and I learned quite a bit in the process, so I am
grateful.

On Sep 26, 8:22 am, Marnen Laibow-Koser  wrote:
> Dudebotwrote:
> > I appreciate the help, Marnen.  In fact, I have
> >http://api.rubyonrails.org/
> > permanently up while coding rails, and it's the tab to the left of my
> > email as I write this.  I always go first to it, then the guides, then
> > a Google search, and only then do I post here.  However, as one new to
> > rails, I don't "get it" yet.  
>
> I understand.  The hardest thing for me has often been finding features
> I know must exist, but whose names I don't know.
>
> > Unlike ruby, rails is all about
> > nomenclature and formalisms.
>
> Not really, except in some limited parts of the framework.
>
> >  I'm still learning those, and it was
> > easy to overlook the ":scope" option when I re-read
> > "validates_uniqueness_of"'s documentation for the fourth time.  
>
> If on the fourth reading, you are overlooking things, then perhaps your
> docs reading skills are at issue here.
>
> And I'm not trying to be snarky by saying that.  I just want to remind
> you that getting the most out of something like Rails is not only a
> question of technical skills.
>
> > You
> > may forget what it was like to first enter rails,
>
> I do not.  I know that it can be tough.
>
> > but in a formalism
> > rich environment, human navigation can be priceless
>
> Agreed.  The only reason I responded with "RTFM" was that in this case,
> you clearly knew the name of the function you needed to call, so you
> would know where to look.
>
> --as it was in your
>
> > post.  So, thanks.
>
> You're welcome.
>
> > Craig
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Editing "Tutorials"

2009-09-26 Thread Joe

Strangely.. I acctually figured out what was wrong and corrected to:
edit_category_tutorial_path(@tutorial_category.id, @tutorial)

which seems to lead to the edit page. However I now have an issue on
this page, as the form as it was (  <% form_for(@tutorial) do |f| %> )
gives the error:

undefined method `tutorial_path'

So I decided logically to change it to:   <% form_for
(@tutorial_category.id, @tutorial) do |f| %>

which gave a fixnum error, which I read was because I used  ".id"
which is a fixed integer so i changed it to:

<% form_for(@tutorial_category, @tutorial) do |f| %>

which now gives me the error I cant solve:

undefined method `nil_class_path' for #

(or something of those origins)


Please Help me solve this issue, and sorry for my permanent bumping
and this time I shall wait until I decide to bump (if I decide to bump
atall)


Thanks In Advance,


Joe

On Sep 26, 5:33 pm, Joe  wrote:
> Yes correct I am desperate rather often as I was supposed to only take
> my site down for a few says to do this and it hs extended onto weeks.
>
> I will read the link (although im so bas in RoR im not honestly sure
> if i'll understand it),
>
> If anyone wants to give a more direct answer please feel free to do
> so, as the chances are I havnt been able to figure it out.
>
> Regards,
>
> Joe
>
> On Sep 26, 3:01 pm, richardun  wrote:
>
> > Marnen is right.  You're not going to get far with people's help most
> > places if you don't take the minimal effort to be courteous (or at
> > least stop using "Soz").
>
> > You seem to be desperate rather often (http://groups.google.com/group/
> > rubyonrails-talk/browse_thread/thread/
> > a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need
> > to bump before 24 hours.
>
> > I will tell you, there is a way to evaluate / display the path you're
> > trying to use using script/console.  You should also read 
> > this:http://api.rubyonrails.org/classes/ActionController/Routing.html
>
> > R
>
> > On Sep 26, 7:05 am, Joe  wrote:
>
> > > Any1??
>
> > > (Soz for bump, im just RLLY desperate to fix)
>
> > > On Sep 25, 6:02 pm, Joe  wrote:
>
> > > > Then I get this error on the tutorial show page:
>
> > > > edit_category_tutorial_url failed to generate from
> > > > {:action=>"edit", :controller=>"tutorials", :category_id=># > > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the
> > > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at:
> > > > "2009-09-21 15:55:54">}, expected:
> > > > {:action=>"edit", :controller=>"tutorials"}, diff:
> > > > {:category_id=># > > > Name", content: "Thetutorialscontent", created_at: "2009-09-21
> > > > 15:55:54", updated_at: "2009-09-21 15:55:54">}
>
> > > > On Sep 25, 9:11 am, bill walton  wrote:
>
> > > > > Hi Joe,
>
> > > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:
> > > > > > edit_category GET /categories/:id/edit(.:format)
> > > > > > edit_category_tutorial GET  
> > > > > > /categories/:category_id/tutorials/:id/edit
> > > > > > (.:format)
>
> > > > > > > On Sep 24, 11:09 am, Joe  wrote:
>
> > > > > > > > <%= link_to 'Edit', edit_category_path(@category) %>
>
> > > > > > > > but when I change this totutorials:
>
> > > > > > > > <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> > > > > > > > I get this error on the tutorial show page:
>
> > > > > > > > undefined method `edit_tutorial_path' for # > > > > > > > 0x5ce52fc>
>
> > > > > It looks like you just need to use the correct route which, it 
> > > > > appears,
> > > > > is named:
>
> > > > > edit_category_tutorial_path
>
> > > > > HTH,
> > > > > Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: I'm restarting to work with ruby on rails, but having configurations problems

2009-09-26 Thread Richard Navarrete
http://lmgtfy.com/?q=uninitialized+constant+ApplicationController

This code must be from before 2.3... you need to update it:

:; rake rails:update

Or, you can rename the controllers/application.rb file to
controllers/application_controller.rb - but you're better off running the
command.  Depending on how old the code is, you might create a whole new
rails app, then copy your code to it or replace config files with the new
ones and create any missing folders.

Lots of folks went through this upgrading to 2.3 or 2.3.2... google it a
bit.

Richard


Try the first link, you might read up on

On Sat, Sep 26, 2009 at 12:47 AM, Delirium tremens wrote:

>
> On 26 set, 02:29, Delirium tremens  wrote:
> > I have the Shovell source code from the book Simply Rails 2, but I'm
> > having problems running it.
> >
> > "Getting started
> > Here’s how to get rolling:
> >
> >1.
> >   Create your databases and edit config/database.yml
> >
> >   Rails needs to know your login and password.
> >2.
> >   Use script/generate to create your models and controllers
> >
> >   To see all available options, run it without parameters.
> >3.
> >   Set up a default route and remove or rename this file
> >
> >   Routes are set up in config/routes.rb."
> >
> > I took step 1, then since the models and controllers are already
> > generated for a source code that already exists, I skipped step 2 and
> > since a default route is already set for a source code that already
> > exists, I skipped step 3.
> >
> > My config/roubes.rb has map.root :controller => "stories",
> buthttp://localhost:3000/still doesn't load the stories controller
> > index. Why?
>
> I hadn't deleted public/index.html, but now I'm getting the error
> message http://pastie.org/631341 How to solve?
> >
>

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



[Rails] Re: Editing "Tutorials"

2009-09-26 Thread richardun

Marnen is right.  You're not going to get far with people's help most
places if you don't take the minimal effort to be courteous (or at
least stop using "Soz").

You seem to be desperate rather often (http://groups.google.com/group/
rubyonrails-talk/browse_thread/thread/
a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need
to bump before 24 hours.

I will tell you, there is a way to evaluate / display the path you're
trying to use using script/console.  You should also read this:
http://api.rubyonrails.org/classes/ActionController/Routing.html

R



On Sep 26, 7:05 am, Joe  wrote:
> Any1??
>
> (Soz for bump, im just RLLY desperate to fix)
>
> On Sep 25, 6:02 pm, Joe  wrote:
>
> > Then I get this error on the tutorial show page:
>
> > edit_category_tutorial_url failed to generate from
> > {:action=>"edit", :controller=>"tutorials", :category_id=># > id: 14, category_id: 1, name: "Thetutorialsname", content: "the
> >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at:
> > "2009-09-21 15:55:54">}, expected:
> > {:action=>"edit", :controller=>"tutorials"}, diff:
> > {:category_id=># > Name", content: "Thetutorialscontent", created_at: "2009-09-21
> > 15:55:54", updated_at: "2009-09-21 15:55:54">}
>
> > On Sep 25, 9:11 am, bill walton  wrote:
>
> > > Hi Joe,
>
> > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:
> > > > edit_category GET /categories/:id/edit(.:format)
> > > > edit_category_tutorial GET  /categories/:category_id/tutorials/:id/edit
> > > > (.:format)
>
> > > > > On Sep 24, 11:09 am, Joe  wrote:
>
> > > > > > <%= link_to 'Edit', edit_category_path(@category) %>
>
> > > > > > but when I change this totutorials:
>
> > > > > > <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> > > > > > I get this error on the tutorial show page:
>
> > > > > > undefined method `edit_tutorial_path' for # > > > > > 0x5ce52fc>
>
> > > It looks like you just need to use the correct route which, it appears,
> > > is named:
>
> > > edit_category_tutorial_path
>
> > > HTH,
> > > Bill
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: dynamic form problem

2009-09-26 Thread Greg Donald

On Fri, Sep 25, 2009 at 5:49 PM, Hassan Schroeder
 wrote:
> I assumed the OP meant  "empty"

Yeah, typo, I usually do something like

 


-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-26 Thread Jeffrey L. Taylor

My m1.small instance on AWS costs me $75-$80/month.  Rackspace does offer
smaller configurations than AWS.  When you compare similar configurations,
e.g., 1.5GB - 2.0GB memory, costs are similar.

When I was comparing the two, Rackspace was having a lot of downtime, 3-5/day,
and Amazon wasn't, 3-7/week.  I am seeing connectivity problems with my app
on AWS that don't show in the Amazon status blogs.  Not sure whether that is
my bug or theirs.

Just my $0.02USD,
  Jeffrey


Quoting Tony Primerano :
> 
> Agreed. Rackspace is great.   Especially when you're 1st building your
> application.  I had apache/passenger and mysql running just fine on a
> 256MB instance.  cost?  about $11/month.
> 
> http://www.tonycode.com/blog/archives/122
> 
> There is EC2 on Rails but AWS starts at about $90/month.  I'm really
> happy with rackspace.
> 
> On Sep 25, 6:18 pm, Greg Donald  wrote:
> > On Fri, Sep 25, 2009 at 4:43 PM, Greg Hauptmann
> >
> >  wrote:
> >
> > > any pointers / suggestions re cheapest Rails hosting where they give
> > > you full access to Apache (to load modules etc)???  Can be a shared
> > > platform, however not sure if there is a shared platform type hosting
> > > service where they do give you such access?
> >
> > Cloud hosting is probably the cheapest you'll find where you have root
> > access.  I'm using Rackspace Cloud.

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



[Rails] autotest: No such file or directory - -u (Errno::ENOENT)

2009-09-26 Thread Joe Hannes

Hi there,

I currently can not get autottest to run:

loading autotest/rails
/opt/local/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit
test/functional/home_controller_test.rb
test/unit/helpers/home_helper_test.rb].each { |f| require f }" |
unit_diff -u
/opt/local/lib/ruby/gems/1.8/gems/ZenTest-4.1.4/lib/unit_diff.rb:70:in
`gets': No such file or directory - -u (Errno::ENOENT)
  from
/opt/local/lib/ruby/gems/1.8/gems/ZenTest-4.1.4/lib/unit_diff.rb:70:in
`parse_input'
  from
/opt/local/lib/ruby/gems/1.8/gems/ZenTest-4.1.4/lib/unit_diff.rb:182:in
`unit_diff'
  from
/opt/local/lib/ruby/gems/1.8/gems/ZenTest-4.1.4/lib/unit_diff.rb:56:in
`unit_diff'
  from /opt/local/lib/ruby/gems/1.8/gems/ZenTest-4.1.4/bin/unit_diff:37
  from /opt/local/bin/unit_diff:19:in `load'
  from /opt/local/bin/unit_diff:19
/opt/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:108:in
`flush': Broken pipe (Errno::EPIPE)
  from /opt/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:108:in
`output'
  from /opt/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:51:in
`setup_mediator'
  from /opt/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:39:in
`start'
  from /opt/local/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in
`run'
  from /opt/local/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
  from /opt/local/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
  from /opt/local/lib/ruby/1.8/test/unit.rb:278
  from -e:1


Envrionment:

ZenTest 4.1.4
MacOS Leopard
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]


Anybody any idea what's wrong here?

Regards,
Johannes
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: how to pass value to method in controller

2009-09-26 Thread Colin Law

2009/9/26 Aashish Kiran :
>
> how to pass value to method in controller using button_to_remote
>    button_to_remote 'check avaliability',
>          :url => { :action => 'check_for_unique_login', :login =>
> @user.login}
> above code is not working.

What is not working with it?  What do you see as the url parameters in
the log file (log/development.log)?

Colin

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



[Rails] Re: collection_select default selected value

2009-09-26 Thread horliao

This is useful about collection_select :)

http://shiningthrough.co.uk/blog/show/6

On Sep 24, 12:13 am, Eunice Tan 
wrote:
> Hi,
>
> I have some issues with setting the selected value. On my page, user
> selects a State from the drop down and other attributes and click on
> "Find". I want to set the default value of the drop down to the value
> selected prior to clicking "Find".
>
> <%=collection_select(:state, :state_id, @states, :state_id, :state_name,
>           {:prompt => true,  :selected => @selected_state},
>           {:style => 'width:200px;',
>                :onchange => remote_function(:url =>
>                  {:action => 'update_cities'},:with =>
> "'state_id='+value")})%>
>
> In my controller, if I have @selected_state = 1, the dropdown default
> value is shown in the UI. However,  if I have @selected_state =
> state_id, the default value is not set.
>
> Snippet of the code in my controller:
>
> def find
>     state_id = params[:state][:state_id]
>
>     @selected_state = state_id
>
>     /* Some logic here */
>
>     @states = State.find(:all)
>
>    respond_to do |format|
>         format.html { render :action => "index" }
>    end
>  end
>
> Any pointers are appreciated. 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Editing "Tutorials"

2009-09-26 Thread Marnen Laibow-Koser

Joe wrote:
> Any1??

You couldn't wait 24 hours to bump?  You couldn't bother to type full 
words?  Those two things tend to really annoy those in a position to 
help.

> 
> (Soz for bump, im just RLLY desperate to fix)

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: cms like routes

2009-09-26 Thread fredd

I think I solved it my self actually!
It turns out that if you name the id parameter something else (like
article_id) Rails actually divides the params correctly.
So this route:
map.article_by_id '*sections/:article_id', :controller =>
"articles", :action => "show", :article_id => /\d|\d-(.+)/
would detect something like this:
news/sports/football/4
and Rails would route to the article controller and show action with
the following params: {"sections"=>["news", "sports", "football"],
"article_id"=>"4"}
Pretty cool, and hopefully this helps someone else with the same
problem that I had.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Calling ActionView from uninheriting class

2009-09-26 Thread Rick

The easy way to resolve this type of problem is through: http//
api.rubyonrails.org
The Methods panel has, for your example, number_to_currency
(ActionView::Helpers::NumberHelper)

On Sep 24, 3:17 pm, Dudebot  wrote:
> Hi Gurus, I have a class, specified in models cart.rb, which doesn't
> inherit from anything--it's just a container
>
> class Cart
> ...
>
> I just discovered I can't call number_to_currency in that class.  Any
> idea how to "include" it in my code?  I tried
> ActionView.number_to_currency without luck.  I could kill a few lines
> of non-DRY regexp code in cart.rb if I could just use
> number_to_currency.
>
> Many TIA,
> Craig
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Heroku

2009-09-26 Thread Conrad Taylor
Hi Jan, I would recommend speaking with your account representatives or the
Heroku support because there may be configuration issues with your account.

Good luck,

-Conrad

On Sat, Sep 26, 2009 at 3:50 AM, Jan Kadera  wrote:

> Hi,
> have anyone some experience with Heroku?
> I have an account there, but I'm unable to tell git to work with it. Can
> some of you help me please?
>
> Regards
> Jan Kadera
>
> >
>

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



[Rails] how to pass value to method in controller

2009-09-26 Thread Aashish Kiran

how to pass value to method in controller using button_to_remote
button_to_remote 'check avaliability',
  :url => { :action => 'check_for_unique_login', :login =>
@user.login}
above code is not working.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: uniqueness validation perplexity

2009-09-26 Thread Dudebot

I appreciate the help, Marnen.  In fact, I have http://api.rubyonrails.org/
permanently up while coding rails, and it's the tab to the left of my
email as I write this.  I always go first to it, then the guides, then
a Google search, and only then do I post here.  However, as one new to
rails, I don't "get it" yet.  Unlike ruby, rails is all about
nomenclature and formalisms.  I'm still learning those, and it was
easy to overlook the ":scope" option when I re-read
"validates_uniqueness_of"'s documentation for the fourth time.  You
may forget what it was like to first enter rails, but in a formalism
rich environment, human navigation can be priceless--as it was in your
post.  So, thanks.
Craig

On Sep 26, 12:15 am, Marnen Laibow-Koser  wrote:
> Dudebotwrote:
>
> [...]
>
> > Frederick--I'm not sure how to use
> > validates_uniqueness_of with more than one field--can that be done?
>
> I'm going to suggest that you spend less time posting here and more time
> reading docs.  20 seconds of reading the documentation for
> validates_uniqueness_of would have told you about the :scope option.
> Look it up. :)
>
>
>
> > Again, many thanks,
> > Craig
>
> > On Sep 25, 9:35 pm, Frederick Cheung 
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Heroku

2009-09-26 Thread Nicolai Constantin Reuschling

So you are really asking the Rails mailing list for help with a tool
interfacing with a service provider?

Nicolai

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



[Rails] Heroku

2009-09-26 Thread Jan Kadera
Hi,
have anyone some experience with Heroku?
I have an account there, but I'm unable to tell git to work with it. Can
some of you help me please?

Regards
Jan Kadera

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



[Rails] Re: uniqueness validation perplexity

2009-09-26 Thread Marnen Laibow-Koser

Dudebot wrote:
> I appreciate the help, Marnen.  In fact, I have 
> http://api.rubyonrails.org/
> permanently up while coding rails, and it's the tab to the left of my
> email as I write this.  I always go first to it, then the guides, then
> a Google search, and only then do I post here.  However, as one new to
> rails, I don't "get it" yet.  

I understand.  The hardest thing for me has often been finding features 
I know must exist, but whose names I don't know.

> Unlike ruby, rails is all about
> nomenclature and formalisms.

Not really, except in some limited parts of the framework.

>  I'm still learning those, and it was
> easy to overlook the ":scope" option when I re-read
> "validates_uniqueness_of"'s documentation for the fourth time.  

If on the fourth reading, you are overlooking things, then perhaps your 
docs reading skills are at issue here.

And I'm not trying to be snarky by saying that.  I just want to remind 
you that getting the most out of something like Rails is not only a 
question of technical skills.


> You
> may forget what it was like to first enter rails, 

I do not.  I know that it can be tough.

> but in a formalism
> rich environment, human navigation can be priceless

Agreed.  The only reason I responded with "RTFM" was that in this case, 
you clearly knew the name of the function you needed to call, so you 
would know where to look.


--as it was in your
> post.  So, thanks.

You're welcome.

> Craig

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Ruby on Rails - Developers for NCR Delhi

2009-09-26 Thread Indus

Hi , We are looking for RUBY ON RAILS professionals for our UK Base
clients for Gurgaon office.
Pl confirm me asap with your updated resume with following details on
sbsconsulti...@gmail.com or indusconsulti...@gmail.com

Technology- Ruby on Rails
Experience- 3+yrs
Location: Gurgaon

Pl also send me following details:
Current CTC
Expected CTC
Notice Period

Regards
SB Singh
Indus Consulting
SBS Consulting
(IT Service Provider)
+91-011-2953-5530
Mobile:+91- 98 111 07 008
SKYPE-sbsingh32
sbsconsult...@bol.net.in
indusconsulti...@gmail.com
www.linkedin.com/in/indusconsulting

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



[Rails] how to check type of ajax response

2009-09-26 Thread bgumbiker

Hello,
When my post message is successfully saved I am returning simple
message via:

flash[:notice] = "OK"

and when there are some errors due to validation I return the message
in similar way:

flash[:notice] = form.errors.to_xml()

then the message is sent via ajax:

respond_to do |format|
  format.html { redirect_to :back }
  format.js


How can I check on the client side which message was sent before
displaying it?
I am using jQuery.
Thanks,
bogumbiker
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] removing attribute prefix from validation error messages

2009-09-26 Thread bgumbiker

Hello,
Any idea how to remove attribute name from validation error messages?
thanks,
bogumbiker
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-26 Thread Trausti Thor Johannsson
Dreamhost.com is cheap, but does not allow any httpd changes, but you can do
.htaccess files.But slicehost.com is by far the best I have seen.

You just get a linux box, and you can then setup the server as you see fit,
want to use mongrel, use mongrel, want ngnx or lighttpd instead of apache.
 Works just as good.
You are root, and you decide.

Trausti

On Sat, Sep 26, 2009 at 12:46 AM, Tony Primerano
wrote:

>
> Agreed. Rackspace is great.   Especially when you're 1st building your
> application.  I had apache/passenger and mysql running just fine on a
> 256MB instance.  cost?  about $11/month.
>
> http://www.tonycode.com/blog/archives/122
>
> There is EC2 on Rails but AWS starts at about $90/month.  I'm really
> happy with rackspace.
>
> On Sep 25, 6:18 pm, Greg Donald  wrote:
> > On Fri, Sep 25, 2009 at 4:43 PM, Greg Hauptmann
> >
> >  wrote:
> >
> > > any pointers / suggestions re cheapest Rails hosting where they give
> > > you full access to Apache (to load modules etc)???  Can be a shared
> > > platform, however not sure if there is a shared platform type hosting
> > > service where they do give you such access?
> >
> > Cloud hosting is probably the cheapest you'll find where you have root
> > access.  I'm using Rackspace Cloud.
> >
> > http://www.rackspacecloud.com/
> >
> > --
> > Greg Donaldhttp://destiney.com/
> >
>

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



[Rails] Re: Editing "Tutorials"

2009-09-26 Thread Joe

Yes correct I am desperate rather often as I was supposed to only take
my site down for a few says to do this and it hs extended onto weeks.

I will read the link (although im so bas in RoR im not honestly sure
if i'll understand it),


If anyone wants to give a more direct answer please feel free to do
so, as the chances are I havnt been able to figure it out.



Regards,


Joe

On Sep 26, 3:01 pm, richardun  wrote:
> Marnen is right.  You're not going to get far with people's help most
> places if you don't take the minimal effort to be courteous (or at
> least stop using "Soz").
>
> You seem to be desperate rather often (http://groups.google.com/group/
> rubyonrails-talk/browse_thread/thread/
> a25e07d2414e2b32/4bca7399878d02d7#4bca7399878d02d7) and feel the need
> to bump before 24 hours.
>
> I will tell you, there is a way to evaluate / display the path you're
> trying to use using script/console.  You should also read 
> this:http://api.rubyonrails.org/classes/ActionController/Routing.html
>
> R
>
> On Sep 26, 7:05 am, Joe  wrote:
>
> > Any1??
>
> > (Soz for bump, im just RLLY desperate to fix)
>
> > On Sep 25, 6:02 pm, Joe  wrote:
>
> > > Then I get this error on the tutorial show page:
>
> > > edit_category_tutorial_url failed to generate from
> > > {:action=>"edit", :controller=>"tutorials", :category_id=># > > id: 14, category_id: 1, name: "Thetutorialsname", content: "the
> > >tutorialscontent", created_at: "2009-09-21 15:55:54", updated_at:
> > > "2009-09-21 15:55:54">}, expected:
> > > {:action=>"edit", :controller=>"tutorials"}, diff:
> > > {:category_id=># > > Name", content: "Thetutorialscontent", created_at: "2009-09-21
> > > 15:55:54", updated_at: "2009-09-21 15:55:54">}
>
> > > On Sep 25, 9:11 am, bill walton  wrote:
>
> > > > Hi Joe,
>
> > > > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:
> > > > > edit_category GET /categories/:id/edit(.:format)
> > > > > edit_category_tutorial GET  
> > > > > /categories/:category_id/tutorials/:id/edit
> > > > > (.:format)
>
> > > > > > On Sep 24, 11:09 am, Joe  wrote:
>
> > > > > > > <%= link_to 'Edit', edit_category_path(@category) %>
>
> > > > > > > but when I change this totutorials:
>
> > > > > > > <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> > > > > > > I get this error on the tutorial show page:
>
> > > > > > > undefined method `edit_tutorial_path' for # > > > > > > 0x5ce52fc>
>
> > > > It looks like you just need to use the correct route which, it appears,
> > > > is named:
>
> > > > edit_category_tutorial_path
>
> > > > HTH,
> > > > Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Config XLSUITE in Windows

2009-09-26 Thread Rajesh Rajesh

I try to config XLSUITE in my system. I'm facing some problem i resolved
it one by one.

now im facing this error

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.0 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
Exiting
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/tcphack.
rb:13:in `listen': An operation on a socket could not be performed
because the s
ystem lacked sufficient buffer space or because a queue was full. -
listen(2) (E
rrno::ENOBUFS)
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel/tcphack.rb:13:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel.rb:93:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel.rb:93:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel/configurator.rb:139:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel/configurator.rb:139:in `listener'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:99:in `cloaker_'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel/configurator.rb:50:in `call'
from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mon
grel/configurator.rb:50:in `initialize'
 ... 14 levels...
from
C:/Rajesh/RubySamples/xlsuite/vendor/rails/railties/lib/commands/se
rver.rb:49
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire'
from script/server:3

please help me to resolve it. I'm a beginner in RoR.

My System Info:
OS: WindowsXP Service Pack 2
Ruby: 1.8.6
Rails: 2.3.4
MySQL Server: 5.1
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Rails Authentication Tutorial

2009-09-26 Thread ruchika

Hey Kevin

use this restful authentication
i have used it in my many projects and its working fine.

http://railsforum.com/viewtopic.php?pid=74245#p74245



On Sep 25, 10:46 am, "s.ross"  wrote:
> Hello--
>
> On Sep 24, 2009, at 7:56 PM, Kevin M wrote:
>
>
>
>
>
> > I started fresh and did the Restful_authentication with all the bells
> > tutorial, (link to tutorial:http://railsforum.com/viewtopic.php?id=14216
> > ).
>
> > Below is the error I get when I create the database, I did a trace.
>
> > -
> > iMac:restful_authentication_tutorial Meyer$ rake db:create --trace
> > (in /Users/Meyer/Rails/restful_authentication_tutorial)
> > ** Invoke db:create (first_time)
> > ** Invoke db:load_config (first_time)
> > ** Invoke rails_env (first_time)
> > ** Execute rails_env
> > ** Execute db:load_config
> > ** Execute db:create
> > Couldn't create database for {"socket"=>"/var/run/mysqld/mysqld.sock",
> > "reconnect"=>true, "encoding"=>"utf8", "username"=>"root",
> > "adapter"=>"mysql", "password"=>"root", "database"=>"RATdev",
> > "pool"=>5}, charset: utf8, collation: utf8_general_ci (if you set the
> > charset manually, make sure you have a matching collation)
> > -
>
> > I kept the default socket the example had: socket: /var/run/mysqld/
> > mysqld.sock
>
> > Thanks for everyone's suggestions.
>
> > Kevin
>
> Let's take a step back. You have both the Apple version of MySQL and  
> MAMP installed? Are you actually using this successfully or could  
> there be a database connection problem? To factor this out, I  
> recommend you change your adapter to "sqlite3" (and install the Ruby  
> sqlite3 gem). Then change database.yml as:
>
> development:
>    adapter: sqlite3
>    database: db/RATdev.sqlite3
>
> test:
>    adapter: sqlite3
>    database: db/RATtest.sqlite3
>
> Next, create the whole thing using Rake:
>
> rake db:create
>
> See if your problem persists.
>
> In my experience, it is possible to run more than one version of MySQL  
> on one machine, but you have to take pains to separate the sockets and  
> ports between the instances. In other words, you will be working with  
> something other than an "out of the box" installation. That could  
> account for your difficulty.
>
> > On Sep 23, 11:40 pm, Marnen Laibow-Koser  > s.net> wrote:
> >> KevinM wrote:
> >>> Does anyone know a good authentication tutorial they can suggest?  
> >>> I've
> >>> tried several restful authentication ones and an authlogic one on
> >>> RailsCast. But with each one I try, something seems to be missing in
> >>> the tutorial and I can't get it to work. I'm new to Rails so it's
> >>> possible user error on my part.
>
> >> And the problems you're having are...?
>
> >>> I'm on Mac OS X 10.5 and I generate all my apps in the Sites
> >>> directory. Is there a better place to create these applications?
>
> >> Yes -- almost anywhere else, unless you're using Passenger.
>
> >>> thanks for any response.
>
> >> Best,
> >> --
> >> Marnen Laibow-Koserhttp://www.marnen.org
> >> mar...@marnen.org
> >> --
> >> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Drop down list ?

2009-09-26 Thread Colin Law

2009/9/25 Dudebot :
>
> The weird thing is that it is working now with
> f.collection_select :category_id, Category.all, :id, :header instead
> of f.collection_select :category_id, Category.all, :id, :header,
> {}, :multiple => false
>
> so :multiple => false seems to be the problem.  But why?  Is this a
> bug?

It does seem odd.  If you had said :multiple => true then I would
expect to see an array of ids in params, which is what you have.  It
is as if the :multiple has triggered the use of an array even though
you have specified it as false.  In fact of course using false is I
believe redundant as this is the default.  I could not find anything
in the docs that specifies what should happen with a false setting (as
opposed to no setting).  Perhaps it is intended like this, nil means
there will always be a single selection, true or false means it should
be passed as an array (which is what caused your code not to work) and
it either will actually allow multiple selections or not.  There would
be some logic in this for a user who wanted at run time to decide on
whether multiple selections were allowed so he could use :multiple =>
current_option_setting and the code picking up the params would always
expect an array whatever the setting of current_option_setting.

Colin

>
> Again, many thanks,
> Craig
>
> On Sep 25, 2:54 pm, Colin Law  wrote:
>> 2009/9/25 Dudebot :
>>
>>
>>
>>
>>
>>
>>
>> > Thanks again, Colin--in item.rb:
>>
>> > belongs_to :category
>>
>> > And in category.rb:
>>
>> > has_many :items
>>
>> > Item has a field category_id which I intended to populate with the
>> > links from an item to its category.  The field header in the category
>> > db is where the name of the category is.
>>
>> > Am I setting it up wrong then to have:
>>
>> > <%= f.collection_select :category_id, Category.all, :id, :header,
>> > {}, :multiple => false %>
>>
>> > in the form?  It does show up as a drop down box with the names
>> > populated in it.
>>
>> That should be fine as far as I can see, though I don't understand the
>> extra [] in the html you showed.  One question, you said that it is
>> not saving the new category id value, are you sure that it is not
>> saving it, or is it possibly just not displaying it when you come
>> round next time.  Have a look in the db to see.
>>
>> Another question, in an earlier post you showed the record being saved
>> by update_attributes, what are you doing if that fails?  In other
>> words is the save succeeding?
>>
>> I am getting to the point where I don't know what is happening I am afraid.
>>
>> Colin
> >
>

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



[Rails] Re: removing attribute prefix from validation error messages

2009-09-26 Thread ranjan kumar
Try this

class User < ActiveRecord::Base
  validate do |user|
user.errors.add_to_base("This is my custom message") if user.
attribute_name.blank?
  end
end

On Sat, Sep 26, 2009 at 2:52 PM, bgumbiker wrote:

>
> Hello,
> Any idea how to remove attribute name from validation error messages?
> thanks,
> bogumbiker
> >
>

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



[Rails] Re: how to pass value to method in controller

2009-09-26 Thread Aashish Kiran

Aashish Kiran wrote:
> Aashish Kiran wrote:
>> how to pass value to method in controller using button_to_remote
>> button_to_remote 'check avaliability',
>>   :url => { :action => 'check_for_unique_login', :login =>
>> @user.login}
>> above code is not working.
> 
>   value can be params

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

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



[Rails] Re: customize active record attribute display name in error message

2009-09-26 Thread drewB

That is exactly what I was looking for!  Thank you!

On Sep 25, 3:17 pm, richardun  wrote:
> I responded just a bit ago, but I don't see my response, so hopefully
> there won't be two responses...
>
> Essentially, Drew, you can map the column to be something else when
> you call "humanize" on it.  Try this:
>
> class Post < ActiveRecord::Base
>
>   HUMANIZED_COLUMNS = {:msg => "Message"}
>
>   def self.human_attribute_name(attribute)
>     HUMANIZED_COLUMNS[attribute.to_sym] || super
>   end
> end
>
> HTH,
> Richard
>
> On Sep 25, 4:49 pm, drewB  wrote:
>
> > Is there an easy way to customize the display name of the attributed
> > used in a validationerrormessage.  For example, let's say I have an
> > active record with the attribute :msg that is validated for presence.
> > If is doesn't exist I don't want the user to see "msg can't be
> > blank!"  I want it to say "Messagecan't be blank!"  Is there an easy
> > way to do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass value to method in controller

2009-09-26 Thread Aashish Kiran

Aashish Kiran wrote:
> how to pass value to method in controller using button_to_remote
> button_to_remote 'check avaliability',
>   :url => { :action => 'check_for_unique_login', :login =>
> @user.login}
> above code is not working.

  value can be params
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Editing "Tutorials"

2009-09-26 Thread Joe

Any1??

(Soz for bump, im just RLLY desperate to fix)

On Sep 25, 6:02 pm, Joe  wrote:
> Then I get this error on the tutorial show page:
>
> edit_category_tutorial_url failed to generate from
> {:action=>"edit", :controller=>"tutorials", :category_id=># id: 14, category_id: 1, name: "The tutorials name", content: "the
> tutorials content", created_at: "2009-09-21 15:55:54", updated_at:
> "2009-09-21 15:55:54">}, expected:
> {:action=>"edit", :controller=>"tutorials"}, diff:
> {:category_id=># Name", content: "The tutorials content", created_at: "2009-09-21
> 15:55:54", updated_at: "2009-09-21 15:55:54">}
>
> On Sep 25, 9:11 am, bill walton  wrote:
>
> > Hi Joe,
>
> > On Thu, 2009-09-24 at 22:54 -0700, Joe wrote:
> > > edit_category GET /categories/:id/edit(.:format)
> > > edit_category_tutorial GET  /categories/:category_id/tutorials/:id/edit
> > > (.:format)
>
> > > > On Sep 24, 11:09 am, Joe  wrote:
>
> > > > > <%= link_to 'Edit', edit_category_path(@category) %>
>
> > > > > but when I change this to tutorials:
>
> > > > > <%= link_to 'Edit', edit_tutorial_path(@tutorial) %>
>
> > > > > I get this error on the tutorial show page:
>
> > > > > undefined method `edit_tutorial_path' for # > > > > 0x5ce52fc>
>
> > It looks like you just need to use the correct route which, it appears,
> > is named:
>
> > edit_category_tutorial_path
>
> > HTH,
> > Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---