[Rails] [JOBS] RoR Contract Opportunity

2008-10-13 Thread BrandonM

[Overview]
We're a stealth startup, New York-based online social network 
resource site for the book industry. We operate a community that
allows book readers to connect, share, discuss, and discover books
with other readers very easily. We provide a scalable social
experience around reading within the $28B annual book retail market.

[Role]
We're seeking a proficient Ruby on Rails developer from the New York
area to work on a part-time / contract basis for us in order to help
take our existing platform to the next level and ready for public
launch. You would work remotely in unison with our current RoR
developer, not based in New York.

[Status]
Our prototype platform is complete with 2000 private testers utilizing
it, driving feature development, along with a current iPhone app
development project. There is significant industry interest in us,
from industry partnerships to strategic investments from top book
entities and investment firms. Now is a perfect time for the right
developer interested in helping transform the book industry's social
interaction to join us.

[Validity]
We're positioned within an industry that is seeing tremendous growth,
led by Amazon's recently powerful acquisitions in our space. There are
great amounts of investment money currently being focused within the
crossroads of technology and the book industry, a market that we're
serving. As well, one of the iPhone's fastest growing application is a
book-related app.

[Apply]
If you're interested in entering a startup company that is on the
bridge of explosive growth and single-handedly helping our platform
prepare for the inaugural public launch, please send a resume + an
explanation of why you're interested in working with us to:

brandonwmullins [at] gmail [dot] com

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



[Rails] Routes problem.

2008-10-13 Thread gdiazl

Hello,

Just a single problem i can't solve. The scenario...

I have a controller called places but i don't want to link the users
to /places/whatever, i want something like /no/whatever. How to
achieve this?

I have in my routes.rb:

map.resources :no, :controller = places,

map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

My problem is that i don't want to have 2 urls pointing to the same
page.  If I type /places/whatever i got the same as if i type /no/
whatever

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



[Rails] Re: has_many / belongs_to associations

2008-10-13 Thread torm3nt

I'm only guessing here, but I'm thinking maybe that your issue is
centred around the way rails automagically creates the setter and
getter methods for associations. From what I'm seeing, I'm guessing
that has_many creates attr_writer methods whereas belongs_to only
creates attr_reader methods. What this means is, album= will not be an
accessible method, so trying to set the album within a child
association isn't possible (nor should it be). What you need to do is
simply set the album_id. I've never tried to create associative data
the way you are, so I can't say for sure this is the issue, but I
think it's possible. You generally don't create relationships via
belongs_to.

Going the other way, you shouldn't have any problems though.

Ie.

@album = Album.new( your params )
@album.reviews = [ Review.new( review1params ),
Review.new( review2.params ) ]
@album.save

.etc.etc.

Hope that helps.


Kirk Torm3nt Bushell


On Sep 27, 3:38 am, Jon Liu [EMAIL PROTECTED] wrote:
 how do you view the stacktrace?  I thin this is the solution to my
 problem...only now migrations is acting funny with me...

 On Fri, Sep 26, 2008 at 7:27 AM, Frederick Cheung 

 [EMAIL PROTECTED] wrote:

  On Sep 26, 3:18 pm, Jon Liu [EMAIL PROTECTED] wrote:
   I tried manually defining @album like so

id=1
@review=Review.new(params[:review])
@review.album=Album.find(id)
@review.save

   Because of this, I don't think it's that @album was not defined.  Also as
  I
   brought up before, and I think this is key in showing their is something
   fundamentally wrong in my set up, the association doesn't even work at
  the
   command line.

   Ex:
   a=Album.find(1)
   r=Review.new
   r.album=a

   This yields an error that says NoMethodError: undefined method 'album='
  for
   #Review:..

   Any insight?

  Well the full stacktrace is sometimes helpful. Just to be sure, your
  reviews table does have an album_id column ?

  Fred

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



[Rails] Re: Internal server error after editing environment.rb

2008-10-13 Thread torm3nt

Have you restarted the server? Any environment change will result in
an internal error, until you restart your server.

Hope that helps =)



On Oct 13, 6:11 am, Frederick Cheung [EMAIL PROTECTED]
wrote:
 Check your log files. the internal server error could be any number
 of things,from a syntax error to a misconfiguration

 Your authentication token problems could be because when if you make a
 request to a different subdomain than the one that created the form it
 probably isn't sending the session cookie (which the authentication
 token is derived from)

 Sent from my iPhone

 On 12 Oct 2008, at 19:52, Tom Eustace [EMAIL PROTECTED]

 s.net wrote:

  Hi all,

  this is hopefully a quick one for gurus.  I edited my environment.rb
  file, commenting out these lines:

  config.action_controller.session = {
 :session_key = '_test_session',
 :secret  = 'long key here'
   }

  When I browsed to my app, I got the internal server error, I
  immediately
  reverted the changes but still get the error.  I tried a different pc
  and also got the error.  Why is this happening and what can I do to
  resolve it.

  p.s. I commented out the lines as I was getting invalid authentication
  token errors, when sending form data, I'm using a subdomain.

  Any pointers for a ruby newb greatly appreciated,
  thanks
  T
  --
  Posted viahttp://www.ruby-forum.com/.

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



[Rails] newbie question about running mysql

2008-10-13 Thread Raheem

Hello,

I am following the Agile Rails dev book and I like the command line
format used to create example apps in the book. However, I am stuck on
one point. How do I run mysql commands from the Rails prompt. I have a
Win Xp sys. I can start rails from the command prompt. But if I type
mysql, I get an error saying it is not recognized as an internal or
external command.

MySQL 5.0.51 is installed on my system and I can run it using a GUI
but not from the command prompt. Any ideas how to get across this
hurdle? TIA.

- Raheem

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



[Rails] Association Methods

2008-10-13 Thread Daniel

I am a newbie of ruby on rails. And I have met a problem with model
association.

I have 2 tables here, one is item the other is brand, when I
create one new item, I want to select one brand from the list.

Here are the models:

class Brand  ActiveRecord::Base
  has_many :items
end

class Item  ActiveRecord::Base
  belongs_to :brand
end

for item/new view
% form_for(@item) do |f| %
  %= f.error_messages %

  p
%= f.label :Brand %br /
%= f.collection_select(:brand, Brand.find(:all), :id, :name,
{:prompt = please select one brand}) %
  /p
...


I can get the list successfully when create the new item, but when I
press the create button, I've got the Brand(#57323960) expected,
got String(#21132310) AssociationTypeMismatch error

I am not sure why I got the AssociationTypeMismatch error, and how can
I handle this?

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



[Rails] Re: how would you know how to call this rails method (select_all) this starting point of it's Rails API description?

2008-10-13 Thread Frederick Cheung



On Oct 12, 11:38 pm, Greg Hauptmann [EMAIL PROTECTED]
wrote:
 how is it obvious to your Frederick can I ask - how would you know these
 methods will end up where they do - I'm guessing (but might be wrong) you
 would have to look through Rails code to find out how it uses/mixes in the
 methods as the framework instantiates itself.  If I'm correct here this
 would be normal its not obvious to see how you would call the method...
 Am I on the right track here?


I suppose there is some prior knowledge or a bit of experimentation to
know that  connection adapters are split up into those various
modules.

Fred

 On Sun, Oct 12, 2008 at 7:59 PM, Frederick Cheung 

 [EMAIL PROTECTED] wrote:

  On Oct 12, 7:09 am, Greg Hauptmann [EMAIL PROTECTED]
  wrote:
   Hi,
   I'm curious.   If you saw the Rails select_all(sql, name = nil) method
   (rerferhttp://
  api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Da...),
   and wanted to use it, how would you really know how to use it and call
   it
   from this API doco?

   I know from googling that you can call it from within a model by going
   ActiveRecord::Base.connection.select_all(sql_string), but how would I
  have
   worked this out from the API doco.

  That's just me, but it seems kind of obvious to me. The second
  parameter is a bit more mysterious but if it has a default value
  chances are you can just ignore it. the fact that the first parameter
  is called sql strongly implies that you should give it some sql.

  Fred

   Within the API page for the method it
   says it's within Module

   ActiveRecord::ConnectionAdapters::DatabaseStatements.

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



[Rails] Re: Association Methods

2008-10-13 Thread Daniel



On Oct 13, 4:38 pm, Daniel [EMAIL PROTECTED] wrote:
 I am a newbie of ruby on rails. And I have met a problem with model
 association.

 I have 2 tables here, one is item the other is brand, when I
 create one new item, I want to select one brand from the list.

 Here are the models:

 class Brand  ActiveRecord::Base
   has_many :items
 end

 class Item  ActiveRecord::Base
   belongs_to :brand
 end

 for item/new view
 % form_for(@item) do |f| %
   %= f.error_messages %

   p
 %= f.label :Brand %br /
 %= f.collection_select(:brand, Brand.find(:all), :id, :name,
 {:prompt = please select one brand}) %

I sometimes find these helper methods quite confusing.  The key is
what parameters they are sending back to your controller when you hit
the create button.
Check your logs if you're unsure.
The above line is probably sending
  params[:item][:brand] = brand-id
where brand-id is the id number for an existing brand.
Another way to check is to look at the generated select tag; it will
probably be select name=item[brand] ...  (note how 'params' builds
its hash structure off the 'name' attribute).

You might want to change it to:
 %= f.collection_select(:brand_id, Brand.find(:all), :id, :name,
 {:prompt = please select one brand}) %

It depends on what your 'create' controller is doing; I assume you're
just instantiating a new item object and passing over the field values
from 'params'.  So if your object sees params[:item][:brand_id] you
might get what you want - the brand-id will be inserted into the
items.brand_id field.  If it sees 'brand' as per the original, then
I'm guessing it's trying to build the assocation via the Item#brand
association method which probably expects a Brand object and not its
id (in string form).

I always have to go back and check the docs.  So what I've said above
might not be totally right.  Get to know how 'params' is generated.
Writing stuff test-first on your functional tests will start you
thinking like this too.

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



[Rails] Re: Association Methods

2008-10-13 Thread Daniel

Well, thank you very much Daniel :-) your information is quite useful

I checked my code, yes, it is like select name=item[brand] ...
I forgot to mentioned that, I have tried to use %=
f.collection_select(:brand_id, Brand.find(:all), :id, :name,
 {:prompt = please select one brand}) % 
But, I have got another error undefined method `brand_id' for #Item:
0x6ce3258
I assumed maybe there is another place I should take care of? in the
items controller?

I was totally confused, sorry.






On Oct 13, 4:19 pm, Daniel [EMAIL PROTECTED] wrote:
 I sometimes find these helper methods quite confusing.  The key is
 what parameters they are sending back to your controller when you hit
 the create button.
 Check your logs if you're unsure.
 The above line is probably sending
   params[:item][:brand] = brand-id
 where brand-id is the id number for an existing brand.
 Another way to check is to look at the generated select tag; it will
 probably be select name=item[brand] ...  (note how 'params' builds
 its hash structure off the 'name' attribute).

 You might want to change it to:
      %= f.collection_select(:brand_id, Brand.find(:all), :id, :name,
  {:prompt = please select one brand}) %

 It depends on what your 'create' controller is doing; I assume you're
 just instantiating a new item object and passing over the field values
 from 'params'.  So if your object sees params[:item][:brand_id] you
 might get what you want - the brand-id will be inserted into the
 items.brand_id field.  If it sees 'brand' as per the original, then
 I'm guessing it's trying to build the assocation via the Item#brand
 association method which probably expects a Brand object and not its
 id (in string form).

 I always have to go back and check the docs.  So what I've said above
 might not be totally right.  Get to know how 'params' is generated.
 Writing stuff test-first on your functional tests will start you
 thinking like this too.

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



[Rails] Re: Association Methods

2008-10-13 Thread Daniel



On Oct 13, 7:32 pm, Daniel [EMAIL PROTECTED] wrote:
 Well, thank you very much Daniel :-) your information is quite useful

 I checked my code, yes, it is like select name=item[brand] ...
 I forgot to mentioned that, I have tried to use %=
 f.collection_select(:brand_id, Brand.find(:all), :id, :name,
  {:prompt = please select one brand}) % 
 But, I have got another error undefined method `brand_id' for #Item:
 0x6ce3258

Just to make sure: do you have a brand_id integer field in your items
table?
What is the code for your controller - the thing you're posting to?

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



[Rails] Re: Patching auto_link for @username link conversion

2008-10-13 Thread Neil Cauldwell

Frederick Cheung wrote:
 On Oct 13, 10:14�am, Neil Cauldwell [EMAIL PROTECTED]
 wrote:
 Does anyone know of an easy way to convert a unique '@username' (i.e.
 @user.username) using an auto_link-esque helper? I have a method for
 doing it on the way in to the database but, I realise there's a few deal
 breakers with that, such as changing the original character length of
 whatever was posted (by inserting a href).

 Would it be possible to patch auto_link (which I'm already using) to
 work with an @username conversion? I was thinking something along these
 lines;
 
 You certainly could (personally I'd probably alias_method_chain it
 just to add your auto_link_usernames behaviour.
 I'd also worry about getting the scanning text for usernames bit right
 first before wiring it into auto_link
 
 Fred

Thanks Fred. I do have the scanning working just fine on the way in to 
the database but, the problem is that auto_link doesn't 'auto link' 
links preceded with @ - if it did, I would already have a working 
solution (at least, if I was happy with the conversion being done on the 
way in to the database). Either way, considering what needs to happen in 
this particular application, the conversion is better-off being done in 
the view and probably in tandem with auto_link (seeing as auto_link 
already does the job just fine on '@comment.body' - with everything but 
@usernames).

I know little about alias_method_chain - am I right in presuming that it 
allows behavior to be added without 'overwriting' a method? Where would 
the alias_method_chain live?

Also, a little OT; I came across a link to your company site a little 
while back and realised you're based in Cambridge (IIRC). Do you get to 
(or know of?) many Rails/web app meet-ups? I'm in lovely 
Stratford-Upon-Avon. There doesn't appear to be much in the way of 
meet-ups around here.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Focus problem

2008-10-13 Thread Mikael Björkegren

Hi!

When my form loads i have a setFocus to the first textarea. Then when i
use the tab-key it will go to the second textarea for all browsers
except IE6. IE6 jumps to my sidebar where i have advertisments. How can
i solve this problem?

It is just IE6 thats jump to the sidebar div with the ads.

Please help me.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] open a modal window for registration

2008-10-13 Thread Medwedj Potapow

Hello, all!

As first: am a newbie in RoR.

The problem is: I need a modal widow to show some registration fields
for my site.

There is a main window with a button Register on it.
After pressing the button the user should get a modal window with
typical fields  name, surname, username, password and so on AND two
buttons OK and Cancel.
After filling all the fields or pressing one of the buttons the
controller should get the answer and all the data filled in.

As an example I got a jquery script opening a modal window. But no
matter what I try - I cannot get it working in Ruby!! :((( In the
example it works fine! But not  in Ruby!

In attachment there is the working example. If anyone understands how it
can be used in Ruby - please help me!

Thanx a lot in advance!

Attachments:
http://www.ruby-forum.com/attachment/2807/working_example.zip

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

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



[Rails] Database connection switching at runtime

2008-10-13 Thread Priya Saini

Hi All:

I want my application to authenticate user through master database and
accordingly should connect them to their specific database.

I am using the sub-domain as identifier for the user and stores
domain-database information in master database.

Im using a function responsible for mapping domains to database in
application.rb using before_filter :function_call

Default database will be master and function will identify the user
specify db to establish a connection at runtime.

The problem is ..the next time i tries to logout and use different
domain.. it still uses previous database and tries to find
domain-database related information there, which actually is in masters.

Plz suggest me some way to it.

Thanks in Advance
Priya Saini
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Patching auto_link for @username link conversion

2008-10-13 Thread Neil Cauldwell

Does anyone know of an easy way to convert a unique '@username' (i.e.
@user.username) using an auto_link-esque helper? I have a method for
doing it on the way in to the database but, I realise there's a few deal
breakers with that, such as changing the original character length of
whatever was posted (by inserting a href).

Would it be possible to patch auto_link (which I'm already using) to
work with an @username conversion? I was thinking something along these
lines;

 # File actionpack/lib/action_view/helpers/text_helper.rb, line 307
307:   def auto_link(text, link = :all, href_options = {}, block)
308: return '' if text.blank?
309: case link
310:   when :all then
auto_link_email_addresses(auto_link_urls(text, href_options, block),
block)
311:   when :email_addresses then
auto_link_email_addresses(text, block)
312:   when :urlsthen auto_link_urls(text,
href_options, block)
###:   when :usernames   then auto_link_usernames(text,
href_options, block)
313: end
314:   end

I haven't done any patching or delving in to Rails internals before so I
don't how tricky the auto_link_usernames method would be, or, if there's
a better way. Any suggestions?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Problem in Restful Routing

2008-10-13 Thread Rock Roll

Hi. I have a problem in restful routing. My project is a discussion
forum.


The route is

map.resources :forums do |forum|
  forum.resources :topics do |topic|
 topic.resources :posts
  end
end


Everything in the code I wrote are working good.

An example url for a show action of a forum post would be

http://localhost:3000/forums/3/topics/4/posts/90

Now if i replace 90 by 200, I get the post with id 200 which doesn't
belong to topic id 4.

How can i prevent this?

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

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



[Rails] Re: Patching auto_link for @username link conversion

2008-10-13 Thread Frederick Cheung



On Oct 13, 10:14 am, Neil Cauldwell [EMAIL PROTECTED]
wrote:
 Does anyone know of an easy way to convert a unique '@username' (i.e.
 @user.username) using an auto_link-esque helper? I have a method for
 doing it on the way in to the database but, I realise there's a few deal
 breakers with that, such as changing the original character length of
 whatever was posted (by inserting a href).

 Would it be possible to patch auto_link (which I'm already using) to
 work with an @username conversion? I was thinking something along these
 lines;

You certainly could (personally I'd probably alias_method_chain it
just to add your auto_link_usernames behaviour.
I'd also worry about getting the scanning text for usernames bit right
first before wiring it into auto_link

Fred

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



[Rails] How to update the extra field of relationship table when use have_many :throuth effectively

2008-10-13 Thread guofeng.ma




I defined the relationship of two tables as below:

Programme(id,code,name)
Course(id,code,name)
ProgarmmeCourse(id,programme_id,course_id,status)

class Programme  ActiveRecord::Base
  has_many :programme_courses,:dependent=:destroy
end

class ProgrammeCourse  ActiveRecord::Base
  belongs_to :programme
  belongs_to :course  
end

class Course  ActiveRecord::Base
  has_many :programmes,:through=:programme_courses
end

there are a list of courses belong to a programme on Programme's update
page, i can update the status(enable/disable) of course belong to the
programme or add a new course from a list of course.

how to save the field of status(enable/disable) effectively after save
Programme?

Could you please give me a sample?
Thanks for your help

-- 
View this message in context: 
http://www.nabble.com/How-to-update-the-extra-field-of-relationship-table-when-use-have_many-%3Athrouth-effectively-tp19952307p19952307.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.


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



[Rails] Re: to understand the flow of application in ror

2008-10-13 Thread Philipe Farias

Read about Routes. If you're using Rails 2 then you shoud know
something about REST too.
And this is an excelent guide to understand routing in Rails:
http://guides.rails.info/routing/routing_outside_in.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: false is not true failure in unit test

2008-10-13 Thread Jay Pangmi

Frederick Cheung wrote:
 Look at foo.errors
 
 Something like
 puts foo.errors.inspect should do the trick.
 
 Or stick
 debugger
 
 In an appropriate part of your test. When you hit that line you'll
 drop into the debugger

I put the fee.errors.detect at:

def test_positive_perpersonrate
 fee=Fee.new
 ..
 ..
 puts fee.errors.detect
end

but it doesn't print anything except that already showing error 
message..
thanks

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

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



[Rails] Re: newbie question about running mysql

2008-10-13 Thread the69geeks

type 'mysql' on cmd prompt and use '/?' for more...

On Oct 13, 9:35 am, Raheem [EMAIL PROTECTED] wrote:
 Hello,

 I am following the Agile Rails dev book and I like the command line
 format used to create example apps in the book. However, I am stuck on
 one point. How do I run mysql commands from the Rails prompt. I have a
 Win Xp sys. I can start rails from the command prompt. But if I type
 mysql, I get an error saying it is not recognized as an internal or
 external command.

 MySQL 5.0.51 is installed on my system and I can run it using a GUI
 but not from the command prompt. Any ideas how to get across this
 hurdle? TIA.

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



[Rails] Re: Observing few fields in a form - Best Practise?

2008-10-13 Thread Vinay

:) thanks for that. Its working now.


On Oct 13, 2:45 pm, Frederick Cheung [EMAIL PROTECTED]
wrote:
 On Oct 13, 10:36 am, Vinay [EMAIL PROTECTED] wrote: I vaguely remember 
 coming across a post which mentioned how to pass
  multiple form element values through the :with option. Does anyone
  know how to do that?

 That may have been my blog post 
 here:http://www.spacevatican.org/2008/5/17/with-or-without-you-link_to_rem...

 Fred

  On Oct 13, 2:17 pm, Vinay [EMAIL PROTECTED] wrote:

   I have this in place for now.

   %= observe_field 'cart_record_attributes__qty',:frequency = 0.1,:url
   ={:action = 'calculate', :submit = 'cart_form'},:method
   =:get,:with = 'qty='+ element.value %

   i dont see the parameters being passed in the dvlpmnt log. Im
   obviously not doing this right. Help?
   The form is for an instance variable of cart.
   % form_for @cart do |f| %
   and Record is a child model (cart has_many records) and hence the long
   name of the qty field(cart_record_attributes__qty).

   On Oct 11, 9:57 pm, Xavier Noria [EMAIL PROTECTED] wrote:

On Sat, Oct 11, 2008 at 10:57 AM,Vinay[EMAIL PROTECTED] wrote:
 thank you both for your replies!
 So if we consider an invoicing application itself, what you say is
 that i need to observe the fields rate, quantity, tax, etc (say)
 independently, and then send in the whole form when even one field is
 changed? If we take an invoice example, there are going to be fields
 like invoice number, recipient, created on etc which are hardly
 necessary for this calculation right?

A general rule of thumb of mine is: Consider as a first choice the
approach that is both easy and trivially robust.

In this case, submitting the form is just a matter of setting :submit
= 'invoice-form' in the observers.

One could select the strictly needed fields and avoid sending the
invoice number, customer ID, etc. to save a few bytes. But that
introduces more complexity and a coupling point between the form and
JavaScript.

So the question I ask myself is: is there some measure that justifies
that? Is the application having issues with the load or something due
to that? The answer so far is no, so I just :submit the form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: I am C/C++ guy and a Ruby newbie I am looking for

2008-10-13 Thread the69geeks

Oh,
its the Principle of Least Surprise!!



On Oct 7, 8:33 pm, Phillip Koebbe [EMAIL PROTECTED]
wrote:
 Pratik Naik wrote:
  What is PoLS anyways ?

 I'm guessing Principle of Least Surprise.

 Peace.
 --
 Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: false is not true failure in unit test

2008-10-13 Thread Franz Strebel

As Fred mentioned earlier, you need to set family_rate to
something valid, which accdg to your model validation should
be a number greater than or equal to 0.01.

Otherwise the last assert fee.valid? will return false.  You may
have set a valid per_person_rate, but since family_rate is nil,
the object will not be valid.

So looking at your test again, you can do this:

 def test_positive_perpersonrate
   fee=Fee.new(:family_rate = 1.0)   #provide a valid value for family_rate

   fee.per_person_rate = -1.0
   assert !fee.valid?
   assert_equal should be greater than 0, fee.errors.on(:per_person_rate)

   fee.per_person_rate = 0.0
   assert !fee.valid?
   assert_equal should be greater than 0, fee.errors.on(:per_person_rate)

   fee.per_person_rate = 1.0
   assert fee.valid?
 end


Hope this helps.

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



[Rails] Re: has_many / belongs_to associations

2008-10-13 Thread Pardee, Roy

Nah, you can set a parent from a child.  Dig it:

   hh = Album.new(:title = Houses of the Holy, :artist = Led Zepplin)
  = #Album id: nil, title: Houses of the Holy, artist: Led Zepplin, 
release_date: nil, created_at: nil, updated_at: nil
   hhr = Review.new(:title = Led Zep's new album rocks, :review_body = 
Best.  Album.  Ever.)
  = #Review id: nil, title: Led Zep's new album rocks, review_body: Best.  
Album.  Ever., album_id: nil, created_at: nil, updated_at: nil
   hh.save
  = true
   hhr.save
  = true
   hhr.album = hh
  = #Album id: 1, title: Houses of the Holy, artist: Led Zepplin, 
release_date: nil, created_at: 2008-10-13 07:13:04, updated_at: 2008-10-13 
07:13:04
   hhr.save
  = true
  

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
torm3nt
Sent: Sunday, October 12, 2008 9:08 PM
To: Ruby on Rails: Talk
Subject: [Rails] Re: has_many / belongs_to associations


I'm only guessing here, but I'm thinking maybe that your issue is centred 
around the way rails automagically creates the setter and getter methods for 
associations. From what I'm seeing, I'm guessing that has_many creates 
attr_writer methods whereas belongs_to only creates attr_reader methods. What 
this means is, album= will not be an accessible method, so trying to set the 
album within a child
association isn't possible (nor should it be). What you need to do is simply 
set the album_id. I've never tried to create associative data the way you are, 
so I can't say for sure this is the issue, but I think it's possible. You 
generally don't create relationships via belongs_to.

Going the other way, you shouldn't have any problems though.

Ie.

@album = Album.new( your params )
@album.reviews = [ Review.new( review1params ), Review.new( review2.params ) ] 
@album.save

.etc.etc.

Hope that helps.


Kirk Torm3nt Bushell


On Sep 27, 3:38 am, Jon Liu [EMAIL PROTECTED] wrote:
 how do you view the stacktrace?  I thin this is the solution to my
 problem...only now migrations is acting funny with me...

 On Fri, Sep 26, 2008 at 7:27 AM, Frederick Cheung 

 [EMAIL PROTECTED] wrote:

  On Sep 26, 3:18 pm, Jon Liu [EMAIL PROTECTED] wrote:
   I tried manually defining @album like so

id=1
@review=Review.new(params[:review])
@review.album=Album.find(id)
@review.save

   Because of this, I don't think it's that @album was not defined.
   Also as
  I
   brought up before, and I think this is key in showing their is
   something fundamentally wrong in my set up, the association
   doesn't even work at
  the
   command line.

   Ex:
   a=Album.find(1)
   r=Review.new
   r.album=a

   This yields an error that says NoMethodError: undefined method 'album='
  for
   #Review:..

   Any insight?

  Well the full stacktrace is sometimes helpful. Just to be sure, your
  reviews table does have an album_id column ?

  Fred



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



[Rails] Re: false is not true failure in unit test

2008-10-13 Thread Frederick Cheung


On 13 Oct 2008, at 15:02, Jay Pangmi wrote:


 Frederick Cheung wrote:
 Look at foo.errors

 Something like
 puts foo.errors.inspect should do the trick.

 Or stick
 debugger

 In an appropriate part of your test. When you hit that line you'll
 drop into the debugger

 I put the fee.errors.detect at:

 def test_positive_perpersonrate
 fee=Fee.new
 ..
 ..
 puts fee.errors.detect
 end

 but it doesn't print anything except that already showing error
 message..

Why would it? I said inspect, not detect. Also you have to put it just  
before the failing assertion.

Fred


 thanks

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

 


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



[Rails] Re: Observing few fields in a form - Best Practise?

2008-10-13 Thread Frederick Cheung



On Oct 13, 10:36 am, Vinay [EMAIL PROTECTED] wrote:
 I vaguely remember coming across a post which mentioned how to pass
 multiple form element values through the :with option. Does anyone
 know how to do that?

That may have been my blog post here:
http://www.spacevatican.org/2008/5/17/with-or-without-you-link_to_remote-s-mysterious-parameter

Fred
 On Oct 13, 2:17 pm, Vinay [EMAIL PROTECTED] wrote:

  I have this in place for now.

  %= observe_field 'cart_record_attributes__qty',:frequency = 0.1,:url
  ={:action = 'calculate', :submit = 'cart_form'},:method
  =:get,:with = 'qty='+ element.value %

  i dont see the parameters being passed in the dvlpmnt log. Im
  obviously not doing this right. Help?
  The form is for an instance variable of cart.
  % form_for @cart do |f| %
  and Record is a child model (cart has_many records) and hence the long
  name of the qty field(cart_record_attributes__qty).

  On Oct 11, 9:57 pm, Xavier Noria [EMAIL PROTECTED] wrote:

   On Sat, Oct 11, 2008 at 10:57 AM,Vinay[EMAIL PROTECTED] wrote:
thank you both for your replies!
So if we consider an invoicing application itself, what you say is
that i need to observe the fields rate, quantity, tax, etc (say)
independently, and then send in the whole form when even one field is
changed? If we take an invoice example, there are going to be fields
like invoice number, recipient, created on etc which are hardly
necessary for this calculation right?

   A general rule of thumb of mine is: Consider as a first choice the
   approach that is both easy and trivially robust.

   In this case, submitting the form is just a matter of setting :submit
   = 'invoice-form' in the observers.

   One could select the strictly needed fields and avoid sending the
   invoice number, customer ID, etc. to save a few bytes. But that
   introduces more complexity and a coupling point between the form and
   JavaScript.

   So the question I ask myself is: is there some measure that justifies
   that? Is the application having issues with the load or something due
   to that? The answer so far is no, so I just :submit the form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Observing few fields in a form - Best Practise?

2008-10-13 Thread Vinay

I have this in place for now.

%= observe_field 'cart_record_attributes__qty',:frequency = 0.1,:url
={:action = 'calculate', :submit = 'cart_form'},:method
=:get,:with = 'qty='+ element.value %

i dont see the parameters being passed in the dvlpmnt log. Im
obviously not doing this right. Help?
The form is for an instance variable of cart.
% form_for @cart do |f| %
and Record is a child model (cart has_many records) and hence the long
name of the qty field(cart_record_attributes__qty).


On Oct 11, 9:57 pm, Xavier Noria [EMAIL PROTECTED] wrote:
 On Sat, Oct 11, 2008 at 10:57 AM,Vinay[EMAIL PROTECTED] wrote:
  thank you both for your replies!
  So if we consider an invoicing application itself, what you say is
  that i need to observe the fields rate, quantity, tax, etc (say)
  independently, and then send in the whole form when even one field is
  changed? If we take an invoice example, there are going to be fields
  like invoice number, recipient, created on etc which are hardly
  necessary for this calculation right?

 A general rule of thumb of mine is: Consider as a first choice the
 approach that is both easy and trivially robust.

 In this case, submitting the form is just a matter of setting :submit
 = 'invoice-form' in the observers.

 One could select the strictly needed fields and avoid sending the
 invoice number, customer ID, etc. to save a few bytes. But that
 introduces more complexity and a coupling point between the form and
 JavaScript.

 So the question I ask myself is: is there some measure that justifies
 that? Is the application having issues with the load or something due
 to that? The answer so far is no, so I just :submit the form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem in Restful Routing

2008-10-13 Thread Rock Roll

Thanks a lot. I will try this out now
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: false is not true failure in unit test

2008-10-13 Thread Jay Pangmi

Frederick Cheung wrote:
 On 13 Oct 2008, at 15:02, Jay Pangmi wrote:

 Why would it? I said inspect, not detect. Also you have to put it just
 before the failing assertion.
 
 Fred

Sorry, my bad, I wrote incorrectly, but I tried with puts 
fee.errors.inspect only. I will try with Franz way.. thanks
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Searching on two table fields

2008-10-13 Thread Martin Evans

i have a recipe table
id
recipe_title
diet_id
meal_id


I have set up the associations and can create, edit and delete recipes
no problem.
 I have set up navigation with a list of diets for example low carb,
high fibre which when clicked shows all the recipes with that type of
diet. I then display a list of meals, breakast, lunch, dinner snack etc.
I'm unsure how to do the select in the controller/model so that only
breakfast for that diet are shown
Can anyone give me some pointers as to how to proceed.
regards
Martin
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: how to create test data using migration for file_column

2008-10-13 Thread Alex

The easy way to display this is to just store the binary data of the
file.

So you'd have a blob column called image...

Model.create(
  :name = 'john',
  :image = File.read(/Path/To/Image/File/john.jpg)
)

Check out 
http://www.mattberther.com/2007/10/19/uploading-files-to-a-database-using-rails/
for some image handling tips.


On Oct 12, 11:19 pm, Cedric Ced [EMAIL PROTECTED]
wrote:
 Hi,

 i would like to create test data for my client using migration.

 for example:
 Model.create(
 :name = 'john',
 :age = '28'
 )

 how would one do that for the file_column image field? i have tried to
 give the name of the file .jpg, but i get the following error
 message:

 Do not know how to handle a string with value 'X.jpg' that was
 passed to a file_column. Check if the form's encoding has been set to
 'multipart/form-data'.

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



[Rails] Re: open a modal window for registration

2008-10-13 Thread Erol Fornoles

On Oct 13, 8:31 pm, Medwedj Potapow [EMAIL PROTECTED]
wrote:
 Hello, all!

 As first: am a newbie in RoR.

 The problem is: I need a modal widow to show some registration fields
 for my site.

 There is a main window with a button Register on it.
 After pressing the button the user should get a modal window with
 typical fields  name, surname, username, password and so on AND two
 buttons OK and Cancel.
 After filling all the fields or pressing one of the buttons the
 controller should get the answer and all the data filled in.

 As an example I got a jquery script opening a modal window. But no
 matter what I try - I cannot get it working in Ruby!! :((( In the
 example it works fine! But not  in Ruby!

 In attachment there is the working example. If anyone understands how it
 can be used in Ruby - please help me!

 Thanx a lot in advance!

 Attachments:http://www.ruby-forum.com/attachment/2807/working_example.zip

 --
 Posted viahttp://www.ruby-forum.com/.

Not the fault of Ruby. The example you gave was purely a client-side
scenario, although my bet is that Prototype (which comes with RoR) is
conflicting with jQuery.

You have 3 options:

1. Ditch Prototype and use jQuery instead.

http://erolfornoles.blogspot.com/2008/08/using-jquery-on-rails-in-3-easy-steps.html

2. Make Prototype and jQuery play nice with each other.

http://b.lesseverything.com/2006/12/31/making-jquery-and-prototype-play-nice-in-rails

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



[Rails] Re: Problem in Restful Routing

2008-10-13 Thread Franz Strebel

I would think that the find code in your PostsController is something like

@post = Post.find(params[:id])

This of course directly gets the Post with the id specified in the URL.

What you can do to get around it is to drilldown from the Forum, Topic
and then Post.  Something like this:

@forum = Forum.find(params[:forum_id], :include = { :topics = :posts } )
@topic = @forum.topics.select { |topic| topic.id ==
params[:topic_id].to_i }.first
@post = @topic.posts.select { |post| post.id == params[:id].to_i }.first

Please note that the code above is not robust as it does not check for nils.
If @topic were nil for example, the last line to get the post will bomb out.

/franz

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



[Rails] Re: Database connection switching at runtime

2008-10-13 Thread Ar Chron


I assume that your initial case is working:  New web session hits the 
web server, application sees new and uses master database. User logs 
in (verified against master) and is hooked up to the correct database.

Not knowing any of the details of your login/logout or session 
management, it sounds like after logging out, you aren't clearing enough 
data out of the session so that the same browser session would be 
recognized as new (i.e., the same as a totally new browser session) 
when you try to log back in.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Problem with sessions and IE

2008-10-13 Thread renuka

Hi,

I have also same problem of session in ie so can you say me how have
you solved it?

Thanks,

On Sep 27, 4:32 pm, Marie Arago [EMAIL PROTECTED]
wrote:
 Ok I found the problem!

 I fixed it!

 Thx!



 Marie Arago wrote:
  Thank you for all your answers and advices!

  I checked evrything and just added the performing cache :/

  But as you can check with both URL. I still have the problem :/

  Rails Terrorist wrote:
  And check your environment.rb

  Have you change it, 1.2.3, to be 2.1.1 ???
  RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION

  and open your Application.rb, make sure it is correct :

  class ApplicationController  ActionController::Base
# Pick a unique cookie name to distinguish our session data from
  others'
session :session_key = '_ProjectName_session_id'

  Y Reinhart A P
  Blog : Teapoci.BlogSpot.Com

 --
 Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: Virtual attribute setter method in model, how to write a scoped query?

2008-10-13 Thread Vinay

anyone got any ideas? i really need a solution for this to get a
feature working.

On Oct 11, 2:15 pm, Vinay [EMAIL PROTECTED] wrote:
 I have a form that has a virtual attribute 'contact_name'. In the
 setter method for this, I need to scope the query through
 current_user.contacts.find (etc). But current_user is a helper method
 (RESTful authentication) and it is apparently not available in the
 model (where the setter method is located). I tried..
 [EMAIL PROTECTED] = User.find(params[:user_id])
 @contact = @current_user.contacts.find (etc)[/code]
 .. but the params hash too is not available. How can I scope the query
 through the current_user in the model file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routes problem.

2008-10-13 Thread Daniel

On Oct 13, 10:30 am, gdiazl [EMAIL PROTECTED] wrote:
 Hello,

 Just a single problem i can't solve. The scenario...

 I have a controller called places but i don't want to link the users
 to /places/whatever, i want something like /no/whatever. How to
 achieve this?

 I have in my routes.rb:

 map.resources :no, :controller = places,

 map.connect ':controller/:action/:id'
 map.connect ':controller/:action/:id.:format'

 My problem is that i don't want to have 2 urls pointing to the same
 page.  If I type /places/whatever i got the same as if i type /no/
 whatever

/places/whatever is going to be there because of the default routes
above: ie
  map.connect ':controller/:action/:id
You probably don't want to mess with that setting either.

If you really want to use /places/action for something else, then
you'd
need to put a new rule in above the default rules to override them;
something like:
  map.connect 'places/:action/:id' , :controller =
'some_other_controller'
Seems unlikely you'd want to do that.
So, I think living with the two routes isn't a problem.

If you really wanted to shut it off, I guess you could have
'some_other_controller'  send back an http status of 500 or something.
  map.connect 'places' , :controller =
'some_other_controller' , :action = 'warn'

I defer to a routing expert though.

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



[Rails] Re: Observing few fields in a form - Best Practise?

2008-10-13 Thread Vinay

I vaguely remember coming across a post which mentioned how to pass
multiple form element values through the :with option. Does anyone
know how to do that?

On Oct 13, 2:17 pm, Vinay [EMAIL PROTECTED] wrote:
 I have this in place for now.

 %= observe_field 'cart_record_attributes__qty',:frequency = 0.1,:url
 ={:action = 'calculate', :submit = 'cart_form'},:method
 =:get,:with = 'qty='+ element.value %

 i dont see the parameters being passed in the dvlpmnt log. Im
 obviously not doing this right. Help?
 The form is for an instance variable of cart.
 % form_for @cart do |f| %
 and Record is a child model (cart has_many records) and hence the long
 name of the qty field(cart_record_attributes__qty).

 On Oct 11, 9:57 pm, Xavier Noria [EMAIL PROTECTED] wrote:

  On Sat, Oct 11, 2008 at 10:57 AM,Vinay[EMAIL PROTECTED] wrote:
   thank you both for your replies!
   So if we consider an invoicing application itself, what you say is
   that i need to observe the fields rate, quantity, tax, etc (say)
   independently, and then send in the whole form when even one field is
   changed? If we take an invoice example, there are going to be fields
   like invoice number, recipient, created on etc which are hardly
   necessary for this calculation right?

  A general rule of thumb of mine is: Consider as a first choice the
  approach that is both easy and trivially robust.

  In this case, submitting the form is just a matter of setting :submit
  = 'invoice-form' in the observers.

  One could select the strictly needed fields and avoid sending the
  invoice number, customer ID, etc. to save a few bytes. But that
  introduces more complexity and a coupling point between the form and
  JavaScript.

  So the question I ask myself is: is there some measure that justifies
  that? Is the application having issues with the load or something due
  to that? The answer so far is no, so I just :submit the form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Searching on two table fields

2008-10-13 Thread Martin Evans

Roy Pardee wrote:
 I believe e.g., Recipe.find_by_diet_id_and_meal_id(12, 34) should work.

Thanks but how do I pass the parameters in link_to

regards
Martin

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

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



[Rails] Re: Searching on two table fields

2008-10-13 Thread Pardee, Roy

I believe e.g., Recipe.find_by_diet_id_and_meal_id(12, 34) should work.

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Martin Evans
Sent: Monday, October 13, 2008 8:01 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Searching on two table fields


i have a recipe table
id
recipe_title
diet_id
meal_id


I have set up the associations and can create, edit and delete recipes no 
problem.
 I have set up navigation with a list of diets for example low carb, high fibre 
which when clicked shows all the recipes with that type of diet. I then display 
a list of meals, breakast, lunch, dinner snack etc.
I'm unsure how to do the select in the controller/model so that only breakfast 
for that diet are shown Can anyone give me some pointers as to how to proceed.
regards
Martin
--
Posted via http://www.ruby-forum.com/.



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



[Rails] Re: Searching on two table fields

2008-10-13 Thread Pardee, Roy

link_to click me :controller = 'some_controller', :action = 'my_action', 
:this_recipe_id = @recipe, :this_meal_id = @meal

But depending on where you put that link there are probably shorthands you can 
use.

HTH,

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Martin Evans
Sent: Monday, October 13, 2008 9:10 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: Searching on two table fields


Roy Pardee wrote:
 I believe e.g., Recipe.find_by_diet_id_and_meal_id(12, 34) should work.

Thanks but how do I pass the parameters in link_to

regards
Martin

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



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



[Rails] Re: Simple app - problems w/ routes

2008-10-13 Thread Clem Rock

Freddy Andersen wrote:
 Wow there are just so many issues...
 
 First I would highly recommend that you have the same rails version in
 both environments... Is there a reason why you want 1.2.6 on one
 machine and 2.1 on a different machine? These versions are very
 different and I'm sure you will find numerous of issues using the same
 app on 1.2 and 2.1...
 
 Next the routing:
 In your routes you have
 
 :controller/:action/:id
 
 Which should be
 
 localhost/say/hello (the localhost/controller/say/hello Not sure how
 that works in your local environment)
 
 Did you change the rails version in your environment.rb file when you
 tested the code on the other env.?
 
 Could you show your app/controllers/say_controller.rb here?


Thanks for getting back to me on this.

In both my local and remote environment.rb file I have the rails version 
set ast this:

RAILS_GEM_VERSION = '1.2.6'

Unfortunately, for our main work project, we are running our app on a 
1.2.6 rails version so it's safer to run all other apps on this version 
as well on localhost.

Here's my SayController code:

class SayController  ApplicationController
  def hello
  end
end
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Time Zone

2008-10-13 Thread Abhishek shukla
Hello friends,
My question is like if the user select the time zone for his country the
application timezone should display the selected time zone.

so for implement this what i should do?

regards
abhi

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



[Rails] Ditto! Any solutions?

2008-10-13 Thread Vaibhav

Hi,

I'm facing the same problem. I remember using google apps properly on
windows but its giving this error on Ubuntu Hardy

Any suggestions?
Thanks,
--Vaibhav

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



[Rails] Re: Any status of the book Agile Testing With Ruby and Rails?

2008-10-13 Thread Hunt Jon

Just to follow up.

I contacted Apress, and they told me that the book was cancelled.

-J

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

Hi I have been following this discussion and I have added a 
brand_id:integer field to my items table. The create button now works 
and populates the brand column with a number.

I've added this to the item show view:

% for brand in Brand.find(:all, :conditions = {:id = @item.id}) %
  div
%= brand.name %
  /div
% end %

However some of the brand names are not the name I selected when I 
created the entry.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Association Methods

2008-10-13 Thread Frederick Cheung



On Oct 13, 6:54 pm, Paul Young [EMAIL PROTECTED]
wrote:
 Hi I have been following this discussion and I have added a
 brand_id:integer field to my items table. The create button now works
 and populates the brand column with a number.

 I've added this to the item show view:

 % for brand in Brand.find(:all, :conditions = {:id = @item.id}) %
   div
     %= brand.name %
   /div
 % end %

 However some of the brand names are not the name I selected when I
 created the entry.

is this suppose to show the brands for a particular item? The above
can't do that - you're selecting brands whose id matches the items id,
the results will be unpredictable at best. @item.brand contains the
brand you selected for the item.

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

I changed it to this, which appears to work correctly:

% for brand in Brand.find(:all, :conditions = {:id = @item.brand_id}) 
%
  div
%= brand.name %
  /div
% end %
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

So now in my brands view I'm trying to show all of the items associated 
with that brand.

The following returns all items:

% for item in Item.find(:all) %
  %= item.name %
% end %


But obviously I only want the items for a particular brand, so I tried:

% for item in Item.find(:all, :conditions = {:brand_id = @brand.id}) 
%
  %= item.name %
% end %

But I get an error
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

Removed the @ sign from :brand_id = @brand.id:

% for item in Item.find(:all, :conditions = {:brand_id = brand.id}) 
%
  %= item.name %
% end %

Which appears to have fixed things
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: file missing

2008-10-13 Thread Delirium tremens

On 13 out, 15:36, Raistlin Majere [EMAIL PROTECTED] wrote:
 Do you have a rails.cmd or a rails.bat at C:\ruby\bin?

 I have a rails.bat, but not a rails.cmd!

 I am wondering if I accidentally deleted rails.cmd!

 What do you say?

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

What if I only wanted to show the latest item added?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

I've tried:

% for item in brand.items.find(:last) %
  %= item.name %
% end %
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: file missing

2008-10-13 Thread Delirium tremens



On 13 out, 15:40, Delirium tremens [EMAIL PROTECTED] wrote:
 On 13 out, 15:36, Raistlin Majere [EMAIL PROTECTED] wrote:

  Do you have a rails.cmd or a rails.bat at C:\ruby\bin?

  I have a rails.bat, but not a rails.cmd!

  I am wondering if I accidentally deleted rails.cmd!

  What do you say?

 I changed my nick name from Raistlin Majere to Delirium tremens.

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



[Rails] Re: Association Methods

2008-10-13 Thread Paul Young

So I'm using:

% for item in Item.find(:all, :conditions = {:brand_id = brand.id}, 
:limit = 1) %
  %= item.name %
% end %
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: file missing

2008-10-13 Thread Frederick Cheung



On Oct 13, 8:01 pm, Delirium tremens [EMAIL PROTECTED] wrote:
 On 13 out, 15:40, Delirium tremens [EMAIL PROTECTED] wrote:

  On 13 out, 15:36, Raistlin Majere [EMAIL PROTECTED] wrote:

   Do you have a rails.cmd or a rails.bat at C:\ruby\bin?

   I have a rails.bat, but not a rails.cmd!

   I am wondering if I accidentally deleted rails.cmd!

   What do you say?

  I changed my nick name from Raistlin Majere to Delirium tremens.

 Tutorials about configuring Eclipse to create rails projects keep
 mentioning rails.cmd...

IIRC older versions of rubygems used .cmd, newer ones use .bat (http://
osdir.com/ml/lang.ruby.gems.devel/2007-10/msg00071.html)

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



[Rails] Re: Association Methods

2008-10-13 Thread Frederick Cheung



On Oct 13, 8:15 pm, Paul Young [EMAIL PROTECTED]
wrote:
 So I'm using:

find :last only exist in rails 2.1
 % for item in Item.find(:all, :conditions = {:brand_id = brand.id},
 :limit = 1) %

that doesn't return the last item, it shows the first one (however
without an order specified that is not always well defined).

brand.items.find :first is the same as the above, you can add an order
clause to get the last item.

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



[Rails] ruby on rails newbie please help cgi problem

2008-10-13 Thread Adam Hurlburt

Hi Just wondering I installed rails but cant seem to get any CGI scripts
running i created a directory in the railsproject/public directory
called cgi-bin which I gave Options +ExecCGI. Furthermore, I cant get
any .rhtml files to parse embedded ruby. I find ruby on rails extremely
complicated, this is my first experience with configuring apache and
ruby on rails and I am getting very frustrated. I am running apache2 on
ubuntu 7.10 I set up the virtual directory and am greeted with the
riding on rails screen (however if i click about your applications
environment i get an error). I am wondering if I should even be using
rails as i programmed with ruby before using DBI modules for database
connectivity and never had any problems. Mainly what I want to do is get
embedded ruby working. I had this working before with eruby and the
mod_ruby module but i switched to mod_rails and now everything has gone
to crap. Any help is GREATLY appreciated, please bear in mind I am
primarily a windows software programmer and am very new to ubuntu,
apache and rails.

I placed this file in the available-sites directory called gridtest

code
VirtualHost 127.0.1.1:4268
ServerName  gridtest.com
ServerAlias www.gridtest.com
DocumentRoot /var/www/htdocs/railstest/public
Directory /var/www/htdocs/railstest/public/cgi-bin/
   AllowOverride None
   Options +ExecCGI
   Order allow,deny
   Allow from all
/Directory
  /VirtualHost
/code

Thanks,

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

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



[Rails] Re: file missing

2008-10-13 Thread Delirium tremens

On 13 out, 16:21, Frederick Cheung [EMAIL PROTECTED] wrote:
 On Oct 13, 8:01 pm, Delirium tremens [EMAIL PROTECTED] wrote:



  On 13 out, 15:40, Delirium tremens [EMAIL PROTECTED] wrote:

   On 13 out, 15:36, Raistlin Majere [EMAIL PROTECTED] wrote:

Do you have a rails.cmd or a rails.bat at C:\ruby\bin?

I have a rails.bat, but not a rails.cmd!

I am wondering if I accidentally deleted rails.cmd!

What do you say?

   I changed my nick name from Raistlin Majere to Delirium tremens.

  Tutorials about configuring Eclipse to create rails projects keep
  mentioning rails.cmd...

 IIRC older versions of rubygems used .cmd, newer ones use .bat (http://
 osdir.com/ml/lang.ruby.gems.devel/2007-10/msg00071.html)

 Fred

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



[Rails] Shibboleth

2008-10-13 Thread Rob Lacey

Can anyone direct me to a really good tutorial on Shibboleth integration 
with Rails, or indeed some sample code? I've been tearing my hair out 
all day on this one.

Thanks

RobL

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



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

2008-10-13 Thread Frederick Cheung



On Oct 13, 8:35 pm, Adam Hurlburt [EMAIL PROTECTED]
wrote:
 Hi Just wondering I installed rails but cant seem to get any CGI scripts
 running i created a directory in the railsproject/public directory
 called cgi-bin which I gave Options +ExecCGI. Furthermore, I cant get
 any .rhtml files to parse embedded ruby. I find ruby on rails extremely
 complicated, this is my first experience with configuring apache and
 ruby on rails and I am getting very frustrated. I am running apache2 on
 ubuntu 7.10 I set up the virtual directory and am greeted with the
 riding on rails screen (however if i click about your applications
 environment i get an error)

That may be a partial red herring - the stuff to display the
application environment is not loading in production mode (which is
what mod_rails defaults to I believe. Dunno about the rest - I doubt
many people writing rails apps use cgi scripts like that.

Fred

. I am wondering if I should even be using
 rails as i programmed with ruby before using DBI modules for database
 connectivity and never had any problems. Mainly what I want to do is get
 embedded ruby working. I had this working before with eruby and the
 mod_ruby module but i switched to mod_rails and now everything has gone
 to crap. Any help is GREATLY appreciated, please bear in mind I am
 primarily a windows software programmer and am very new to ubuntu,
 apache and rails.

 I placed this file in the available-sites directory called gridtest

 code
 VirtualHost 127.0.1.1:4268
     ServerName  gridtest.com
     ServerAliaswww.gridtest.com
     DocumentRoot /var/www/htdocs/railstest/public
     Directory /var/www/htdocs/railstest/public/cgi-bin/
        AllowOverride None
        Options +ExecCGI
        Order allow,deny
        Allow from all
     /Directory
   /VirtualHost
 /code

 Thanks,

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



[Rails] Re: Problem in Restful Routing

2008-10-13 Thread Piotr Jakubowski

I am not sure if this is correct approach but you could apply the
before filter that could check if given post belongs to given topic
(and the topic belongs to given forum :) )

On Oct 13, 11:32 am, Rock Roll [EMAIL PROTECTED]
wrote:
 Hi. I have a problem in restful routing. My project is a discussion
 forum.

 The route is

 map.resources :forums do |forum|
       forum.resources :topics do |topic|
              topic.resources :posts
       end
 end

 Everything in the code I wrote are working good.

 An example url for a show action of a forum post would be

 http://localhost:3000/forums/3/topics/4/posts/90

 Now if i replace 90 by 200, I get the post with id 200 which doesn't
 belong to topic id 4.

 How can i prevent this?

 Thank you
 --
 Posted viahttp://www.ruby-forum.com/.

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



[Rails] Qustion on rails new threading feature

2008-10-13 Thread Ben Johnson

I am writing a library that deals with class variables. But until
recently all rails requests were in their own process. Now that
threading has been introduced I'm not sure how this effect class
variables, so I was hoping someone can shed some light on this.

If I am threading rails and do something like:

class ApplicationController  ActionController::Base
  around_filter :setting_class_var

  private
def setting_class_var
  User.some_class_var = self
  yield
  User.some_class_var = nil
end
end

My question is will this work properly while threading? I am unsure if
rails does any kind of mutual exclusion. Thanks!
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] ActiveRecord and null string in Oracle

2008-10-13 Thread Don.Mc

When an empty string is stored in Oracle, it is converted to a null.
When I retrieve it with rails, I get a nil object.

I would like to modify my Rails model to return an empty string
instead of
null for that attribute, instead of modifying code in multiple places.
Is
that easily doable? I tried an alias, but that did not work.

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



[Rails] Re: Memory Leak

2008-10-13 Thread Alex Gregianin

Does patchlevel 111 have the same problem as well?

 I've been running ruby 1.8.6 patchlevel 111 on mac,but the
processes grow slightly every request.On my production server running
debian,I've got ruby 1.8.5 from 2006-08-25,and because I've got a lot
of traffic on my production server,memory goes away really fast!I'll
update to ruby 1.8.6 latest release and post the results here.


Thankz!


On Oct 12, 9:50 am, tonypm [EMAIL PROTECTED] wrote:
 Thanks Fred,

 Fedora updated Ruby to:

 ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]

 problems now all gone away - much relieved!!

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



[Rails] Re: Does not validate presence of entry fields

2008-10-13 Thread Philip Hallstrom

 Hi all

 I wrote a small form and I am trying to check if the fields are
 populated.

 My Model is:
 class Contact  ActiveRecord::Base
   validates_presence_of :name,  :email, :body
  validates_length_of :body, :maximum =2000
 end

 -Controller
 class ContactController  ApplicationController
  def new
  @contact = Contact.new
   end
  def create
@contact = Contact.new(params[:contact])
   @contact.save
  end
 end

 --Viewers

 New view

 %= error_messages_for :contact %

 % form_for @contact, :url = { :action = 'create' }, :html = {
 :method = :post }  do |f| %
 fieldset
 legendPlease send your message: /legend
 plabelYour Name:br /%= f.text_field :name, :size = 25
 %/label/p
 plabelYour email:br / %= f.text_field :email, :size = 25
 %/label/p
 plabelMessage:br /%= f.text_area :body, :rows = 10, :cols =  
 30
 %/label/p
 plabel%= submit_tag 'Submit'   % /label/p
 /fieldset
 % end %


 Create view
 h2Thank you for your interest in my site/h2




 When the entry fields are not populated the forms shows the create  
 view
 and does not show any error message. why?

Because you aren't doing anything in the create action to adjust the  
result if there is a failure.  You want something more like this:

def create
   @contact = Contact.new(params[:contact])
   unless @contact.save
 render :action = 'new'
 return
   end
end

Or this which is pretty close to the default generated by Rails  
scaffolding.

   def create
 @contact = Contact.new(params[:contact])

 if @contact.save
   flash[:notice] = 'Contact was successfully created.'
   redirect_to(contact_path(@contact))
 else
   render :action = new
 end
   end

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



[Rails] Re: Time Zone

2008-10-13 Thread Nathan Esquenazi

Follow this tutorial:

http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/

Abhishek shukla wrote:
 Hello friends,
 My question is like if the user select the time zone for his country the
 application timezone should display the selected time zone.
 
 so for implement this what i should do?
 
 regards
 abhi

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

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



[Rails] Re: Database connection switching at runtime

2008-10-13 Thread Priya Saini

Hi Chron:

Thanks for the reply.
Yes the initial case is working but there is something to be decided 
there as well.
In application.rb
i use  before_filter :switch_db
  def switch_db
  @db = Client.find_by_domain_name(request.env['HTTP_HOST'])
  db_name =  @db.database_name
  ActiveRecord::Base.establish_connection(
  :adapter  = mysql,
  :host = ,
  :username = ,
  :password = ,
  :database = db_name,
  :port = 
  )
  end
Initially it selects the db well but since application.rb is called 
always the function gets executed each time and tries to find client in 
the current db.
What condition shall be placed to by pass this function if there already 
exists a database connection [other than with master].

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

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



[Rails] Re: Plugin Installation Help

2008-10-13 Thread Jaus LXXIV

Alright, I installed an older version of Rails and copied
pagination.rb from

C:\ruby\lib\ruby\gems\1.8\gems\actionpack-1.13.3\lib\action_controller

and pasted it in

C:\ruby\lib\ruby\gems\1.8\gems\actionpack-2.0.1\lib\action_controller

but I still get undefined method paginate when I try to display the
page. Are there some other files I need to copy/settings I need to
change? The app is running Rails 2.0.1, by the way.
Again, thanks for all your help on this.

James

On Oct 12, 4:44 pm, Frederick Cheung [EMAIL PROTECTED]
wrote:
 On Oct 12, 8:30 pm, Jaus LXXIV [EMAIL PROTECTED] wrote:

  So I downloaded two different versions of the svn client and I still
  can't install the plugin. This is getting kind of annoying because I
  was able to install auto_complete with no problem. Also, I'm going to
  have to get this rails code running on my employer's computer and I
  don't really want to make him install a program he's only going to use
  to install a single plugin. Is there an easier way to have classic
  pagination (as in without installing svn), or is there something
  really obvious that I'm missing?

 script/plugin just copies the plugin from wherever it is to vendor/
 plugins (and runs install.rb if it's there, this is not very common).
 If you can grab the files from somewhere else you can just copy them
 in.
 I can't check out code from that url either (svn: Can't connect to
 host 'errtheblog.com': Connection refused) so it may just be
 unavailable right now.

 Once you've got the plugin in your app you don't need svn

 Fred



  Thanks.

  On Oct 11, 8:41 pm, Frederick Cheung [EMAIL PROTECTED]
  wrote:

   On Oct 12, 1:09 am, Jaus LXXIV [EMAIL PROTECTED] wrote:  Do you have 
   the svn command line client installed (ie if you just type
 svn at a command line prompt does it run?)

 Fred

No, I don't. Can you give me a link where I can download it? Thanks
again.

   it's the first hit if you google for svn.

   Fred- Hide quoted text -

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



[Rails] Google Maps Plugin

2008-10-13 Thread David

Hi I am looking for some input on the google map plugins that are out
there.  I want to be able to use a google map within my site where two
addresses can be entered and the directions along with the path are
shown.  Is this possible with the Google Maps API in general?  And if
so, does anyone have any implementation experience with any of the
rails plugins out there to give advice on the best one?  Is there one
that will be easier to add directions capability to?  Thanks, Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Rmagick

2008-10-13 Thread Shiva Kumaran

Hi,
  I am using imagemagick and rmagick for image manipulation

imagemagick version-6.4.4
rmagick 2.7

I need to create a thumbnail.

img = Magick::Image.read(org_img_path)[0]
img.crop_resized(width,height)
img.write(new_image_path)


when i used this piece of code in console its cropping correctly...when
i used inside model or lib or controller its not working.

but if i use crop_resized! it is working but i need to maintain aspect
ratio for that image.

If someone knows solutin for this problem kindly help me

with regards
shiva
-- 
Posted via http://www.ruby-forum.com/.

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