[Rails] Re: ActiveRecord::UnknownAttributeError: unknown attribute:

2010-08-11 Thread jemminger


On Aug 10, 4:47 pm, Gudleik Rasch  wrote:
> Could be a bug or even someone trying to inject malicious javascript
> code into your app.
> Either case its a good practice to have these kind of scenarios
> covered by tests.
>

How?  It's not really feasible to strip attrs that don't belong from
the params... I'd have to query the targeted model for its list of
valid params and then reject non-matches.  The idiom is to trustingly
throw the whole hash at the model - "User.create params[:user]".

 This error doesn't seem to be so much a security risk as just
perplexing.  Happened again on another action today... random field,
"unknown attribute: description

[Rails] ActiveRecord::UnknownAttributeError: unknown attribute:

2010-08-10 Thread jemminger
Has anyone seen this happening to their apps?

I'm starting to get errors like this come across from one of my apps:

  ActiveRecord::UnknownAttributeError: unknown attribute: 

[Rails] Re: ActionController::UnknownHttpMethod: ***, accepted HTTP methods are get, head, put, post, delete, and options

2010-05-14 Thread jemminger
Still getting a slew of these on one of my sites.  Annoying, because
you can't seem to trap it with the normal rescue_from in
application_controller, as Rails seems to intercept this exception
before it ever makes it that far up the chain.


On Apr 7, 2:23 pm, Nikolaj Nikolajsen  wrote:
> Got two of these on one of our sites today within seconds. My guess is
> that it's a bot scanning for vulnerabilities on the site.
>
> Error: ActionController::UnknownHttpMethod: CONNECT, accepted HTTP
> methods are get, head, put, post, delete, and options
> Action: Internal
> URL:http://mail.messaging.microsoft.com:25/
> Parameters: {"action"=>"", "controller"=>""}
> File: [GEM_ROOT]/gems/actionpack-2.3.5/lib/action_controller/
> request.rb:35
>
> Error: ActionController::UnknownHttpMethod: CONNECT, accepted HTTP
> methods are get, head, put, post, delete, and options
> Action: Internal
> URL:http://www.google.com:443/
> Parameters: {"action"=>"", "controller"=>""}
> File: [GEM_ROOT]/gems/actionpack-2.3.5/lib/action_controller/
> request.rb:35
>
> I would also like to hear from others experiencing this, and if any
> precautions should be taken...
>
> /nikolaj

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



[Rails] ActionController::UnknownHttpMethod: ***, accepted HTTP methods are get, head, put, post, delete, and options

2010-03-28 Thread jemminger
I'm occasionally getting exception notices with this error message:

  ActionController::UnknownHttpMethod: ***, accepted HTTP methods are
get, head, put, post, delete, and options

Anyone ever seen this or know what could be causing it?

Thanks,
Jeff

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-18 Thread jemminger
Conrad,

:ymd is a custom format I've defined in my environment.rb.

The issue is resolved however; see a few posts above.

Thanks,
Jeff


On Feb 18, 1:31 pm, Conrad Taylor  wrote:
> On Tue, Feb 16, 2010 at 7:35 PM, jemminger  wrote:
>
> > > Are you started script/console in production mode?
>
> > Yes, the console is in the same environment as the app.  The app is
> > running through passenger 2.2.9
>
> > > When you look at
> > > the production database does this field have a value set?
>
> > Yes, it's fine in the database,
>
> > > Lastly, can
> > > you provide a code fragment?
>
> > In my view:
> >        <%= contact.created_at.to_s(:ymd) %>
>
> From the Rails 2.3.5 API, the above should be written as follows:
>
> <%= contact.created_at.to_s %>
>
> Perhaps, there's something within your code that you're not displaying
> here because I wasn't able to reproduce the error message.
> Thus, could you post a complete code fragment that reproduces the
> the below error message?
>
> -Conrad
>
> > Which results in:
> >  ActionView::TemplateError (wrong number of arguments (1 for 0)) on
> > line... pointing at the line above, because 'created_at' is nil.  I
> > know this because changing it to
>
> >        <%= contact.created_at.to_s(:ymd) rescue
> > contact.created_at.inspect %>
>
> > results in "nil".
>
> > Via console:
>
> > [r...@server current]# ./script/console staging
> > Loading staging environment (Rails 2.3.5)
> > >> c = Contact.find 368299
> > => # > last_name: "Android", is_active: 1, created_at: "2009-11-12 20:47:34",
> > updated_at: nil, deleted_at: nil>
> > >> c.created_at
> > => Thu, 12 Nov 2009 20:47:34 UTC +00:00
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-18 Thread jemminger
@ben:

You were right after all!  I had in my application controller a line
where I was also setting ActiveRecord::Base.default_timezone.
Removing this fixed it.

Thanks again!


On Feb 18, 12:22 pm, jemminger  wrote:
> Same problem under ruby 1.8.6 on the server.
>
> So far I seem to know:
>
> - It isn't the ruby version, as it happens under 1.8.6, 1.8.7 and 1.9
>
> - It isn't the webserver, as it happens with Passenger and Webrick
>
> This would suggest it's my app, yet the exact same app works as
> expected on my macbook in both development and test mode.  Also the
> fact that on the server, I can issue the exact same statement that the
> controller is issuing, and I get my datetime fields parsed into ruby
> datetimes as expected, yet via the webserver it does not work.
>
> I'm out of ideas.
>
> On Feb 18, 1:09 am, jemminger  wrote:
>
> > Yeah, I have both of those lines in my environment.rb too.  Commenting
> > out the first doesn't seem to help my issue though, but thanks for the
> > attempt.  I'm going to try reverting to Ruby 1.8.6 next.
>
> > On Feb 17, 6:09 pm, ben wiseley  wrote:
>
> > > I don't know if this is related but I spent half my morning trying to 
> > > figure
> > > out why I was getting nil.include? errors for date fields only after
> > > reloading the page (Ruby 1.8.7, Rails 2.3.5).   This was the fix (in
> > > env.rb):
>
> > >   #config.time_zone = 'UTC'
>
> > >   config.active_record.default_timezone = :utc
>
> > > On Wed, Feb 17, 2010 at 2:52 PM, jemminger  wrote:
> > > > I thought this might have been a Passenger bug, but I just tried with
> > > > Webrick right now and I get the same problem.
>
> > > > Any ideas on what could be different between Rails loading the objects
> > > > for the web vs. the console?
>
> > > > On Feb 16, 10:35 pm, jemminger  wrote:
> > > > > > Are you started script/console in production mode?
>
> > > > > Yes, the console is in the same environment as the app.  The app is
> > > > > running through passenger 2.2.9
>
> > > > > > When you look at
> > > > > > the production database does this field have a value set?
>
> > > > > Yes, it's fine in the database,
>
> > > > > > Lastly, can
> > > > > > you provide a code fragment?
>
> > > > > In my view:
> > > > >         <%= contact.created_at.to_s(:ymd) %>
>
> > > > > Which results in:
> > > > >   ActionView::TemplateError (wrong number of arguments (1 for 0)) on
> > > > > line... pointing at the line above, because 'created_at' is nil.  I
> > > > > know this because changing it to
>
> > > > >         <%= contact.created_at.to_s(:ymd) rescue
> > > > > contact.created_at.inspect %>
>
> > > > > results in "nil".
>
> > > > > Via console:
>
> > > > > [r...@server current]# ./script/console staging
> > > > > Loading staging environment (Rails 2.3.5)>> c = Contact.find 368299
>
> > > > > => # > > > > last_name: "Android", is_active: 1, created_at: "2009-11-12 20:47:34",
> > > > > updated_at: nil, deleted_at: nil>>> c.created_at
>
> > > > > => Thu, 12 Nov 2009 20:47:34 UTC +00:00
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Ruby on Rails: Talk" group.
> > > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > rubyonrails-talk+unsubscr...@googlegroups.com
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-18 Thread jemminger
Same problem under ruby 1.8.6 on the server.

So far I seem to know:

- It isn't the ruby version, as it happens under 1.8.6, 1.8.7 and 1.9

- It isn't the webserver, as it happens with Passenger and Webrick

This would suggest it's my app, yet the exact same app works as
expected on my macbook in both development and test mode.  Also the
fact that on the server, I can issue the exact same statement that the
controller is issuing, and I get my datetime fields parsed into ruby
datetimes as expected, yet via the webserver it does not work.

I'm out of ideas.


On Feb 18, 1:09 am, jemminger  wrote:
> Yeah, I have both of those lines in my environment.rb too.  Commenting
> out the first doesn't seem to help my issue though, but thanks for the
> attempt.  I'm going to try reverting to Ruby 1.8.6 next.
>
> On Feb 17, 6:09 pm, ben wiseley  wrote:
>
> > I don't know if this is related but I spent half my morning trying to figure
> > out why I was getting nil.include? errors for date fields only after
> > reloading the page (Ruby 1.8.7, Rails 2.3.5).   This was the fix (in
> > env.rb):
>
> >   #config.time_zone = 'UTC'
>
> >   config.active_record.default_timezone = :utc
>
> > On Wed, Feb 17, 2010 at 2:52 PM, jemminger  wrote:
> > > I thought this might have been a Passenger bug, but I just tried with
> > > Webrick right now and I get the same problem.
>
> > > Any ideas on what could be different between Rails loading the objects
> > > for the web vs. the console?
>
> > > On Feb 16, 10:35 pm, jemminger  wrote:
> > > > > Are you started script/console in production mode?
>
> > > > Yes, the console is in the same environment as the app.  The app is
> > > > running through passenger 2.2.9
>
> > > > > When you look at
> > > > > the production database does this field have a value set?
>
> > > > Yes, it's fine in the database,
>
> > > > > Lastly, can
> > > > > you provide a code fragment?
>
> > > > In my view:
> > > >         <%= contact.created_at.to_s(:ymd) %>
>
> > > > Which results in:
> > > >   ActionView::TemplateError (wrong number of arguments (1 for 0)) on
> > > > line... pointing at the line above, because 'created_at' is nil.  I
> > > > know this because changing it to
>
> > > >         <%= contact.created_at.to_s(:ymd) rescue
> > > > contact.created_at.inspect %>
>
> > > > results in "nil".
>
> > > > Via console:
>
> > > > [r...@server current]# ./script/console staging
> > > > Loading staging environment (Rails 2.3.5)>> c = Contact.find 368299
>
> > > > => # > > > last_name: "Android", is_active: 1, created_at: "2009-11-12 20:47:34",
> > > > updated_at: nil, deleted_at: nil>>> c.created_at
>
> > > > => Thu, 12 Nov 2009 20:47:34 UTC +00:00
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-17 Thread jemminger
Yeah, I have both of those lines in my environment.rb too.  Commenting
out the first doesn't seem to help my issue though, but thanks for the
attempt.  I'm going to try reverting to Ruby 1.8.6 next.


On Feb 17, 6:09 pm, ben wiseley  wrote:
> I don't know if this is related but I spent half my morning trying to figure
> out why I was getting nil.include? errors for date fields only after
> reloading the page (Ruby 1.8.7, Rails 2.3.5).   This was the fix (in
> env.rb):
>
>   #config.time_zone = 'UTC'
>
>   config.active_record.default_timezone = :utc
>
> On Wed, Feb 17, 2010 at 2:52 PM, jemminger  wrote:
> > I thought this might have been a Passenger bug, but I just tried with
> > Webrick right now and I get the same problem.
>
> > Any ideas on what could be different between Rails loading the objects
> > for the web vs. the console?
>
> > On Feb 16, 10:35 pm, jemminger  wrote:
> > > > Are you started script/console in production mode?
>
> > > Yes, the console is in the same environment as the app.  The app is
> > > running through passenger 2.2.9
>
> > > > When you look at
> > > > the production database does this field have a value set?
>
> > > Yes, it's fine in the database,
>
> > > > Lastly, can
> > > > you provide a code fragment?
>
> > > In my view:
> > >         <%= contact.created_at.to_s(:ymd) %>
>
> > > Which results in:
> > >   ActionView::TemplateError (wrong number of arguments (1 for 0)) on
> > > line... pointing at the line above, because 'created_at' is nil.  I
> > > know this because changing it to
>
> > >         <%= contact.created_at.to_s(:ymd) rescue
> > > contact.created_at.inspect %>
>
> > > results in "nil".
>
> > > Via console:
>
> > > [r...@server current]# ./script/console staging
> > > Loading staging environment (Rails 2.3.5)>> c = Contact.find 368299
>
> > > => # > > last_name: "Android", is_active: 1, created_at: "2009-11-12 20:47:34",
> > > updated_at: nil, deleted_at: nil>>> c.created_at
>
> > > => Thu, 12 Nov 2009 20:47:34 UTC +00:00
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-17 Thread jemminger
I thought this might have been a Passenger bug, but I just tried with
Webrick right now and I get the same problem.

Any ideas on what could be different between Rails loading the objects
for the web vs. the console?



On Feb 16, 10:35 pm, jemminger  wrote:
> > Are you started script/console in production mode?
>
> Yes, the console is in the same environment as the app.  The app is
> running through passenger 2.2.9
>
> > When you look at
> > the production database does this field have a value set?
>
> Yes, it's fine in the database,
>
> > Lastly, can
> > you provide a code fragment?
>
> In my view:
>         <%= contact.created_at.to_s(:ymd) %>
>
> Which results in:
>   ActionView::TemplateError (wrong number of arguments (1 for 0)) on
> line... pointing at the line above, because 'created_at' is nil.  I
> know this because changing it to
>
>         <%= contact.created_at.to_s(:ymd) rescue
> contact.created_at.inspect %>
>
> results in "nil".
>
> Via console:
>
> [r...@server current]# ./script/console staging
> Loading staging environment (Rails 2.3.5)>> c = Contact.find 368299
>
> => # last_name: "Android", is_active: 1, created_at: "2009-11-12 20:47:34",
> updated_at: nil, deleted_at: nil>>> c.created_at
>
> => Thu, 12 Nov 2009 20:47:34 UTC +00:00
>
>

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-16 Thread jemminger

>
> Are you started script/console in production mode?

Yes, the console is in the same environment as the app.  The app is
running through passenger 2.2.9

> When you look at
> the production database does this field have a value set?

Yes, it's fine in the database,

> Lastly, can
> you provide a code fragment?
>

In my view:
<%= contact.created_at.to_s(:ymd) %>

Which results in:
  ActionView::TemplateError (wrong number of arguments (1 for 0)) on
line... pointing at the line above, because 'created_at' is nil.  I
know this because changing it to

<%= contact.created_at.to_s(:ymd) rescue
contact.created_at.inspect %>

results in "nil".



Via console:

[r...@server current]# ./script/console staging
Loading staging environment (Rails 2.3.5)
>> c = Contact.find 368299
=> #
>> c.created_at
=> Thu, 12 Nov 2009 20:47:34 UTC +00:00
>>

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



[Rails] Re: dates not being typecast properly, becoming nil?

2010-02-16 Thread jemminger
MySQL 5.0.77 on the server



On Feb 16, 7:41 pm, Robert Walker  wrote:
> Jeff Emminger wrote:
> > I have a rails 2.3.5 app running on ruby 1.8.7 (2008-08-11 patchlevel
> > 72) [i686-darwin9] locally, and everything is fine.
>
> > I'm trying to deploy it to my server, running centos 5.4, ruby 1.8.7
> > (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby
> > Enterprise Edition 2010.01.
>
> > When I retrieve records via the app, the created_at is nil.  I can
> > pull the same records through script/console and created_at is
> > properly set as expected.  Through the app though, object.created_at
> > is nil, object.attributes['created_at'] is nil, but
> > object.created_at_before_type_cast returns the proper string from the
> > database.
>
> > Any ideas what's going on?  I'm stumped.
>
> What database are you using? MySQL, PosgreSQL, etc.) I don't see it
> listed here.
> --
> 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] dates not being typecast properly, becoming nil?

2010-02-16 Thread jemminger
I have a rails 2.3.5 app running on ruby 1.8.7 (2008-08-11 patchlevel
72) [i686-darwin9] locally, and everything is fine.

I'm trying to deploy it to my server, running centos 5.4, ruby 1.8.7
(2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby
Enterprise Edition 2010.01.

When I retrieve records via the app, the created_at is nil.  I can
pull the same records through script/console and created_at is
properly set as expected.  Through the app though, object.created_at
is nil, object.attributes['created_at'] is nil, but
object.created_at_before_type_cast returns the proper string from the
database.

Any ideas what's going on?  I'm stumped.

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



[Rails] Re: symbol pointing to a method idiom in ror model

2010-01-24 Thread jemminger
It's a stub of sorts.  When you use "validate :some_symbol" in your
model, it's basically adding that symbol to a stack that it's going to
invoke "model_instance.send(:some_symbol)" (more or less) on when
validation happens.


On Jan 22, 10:28 am, Hiro Protagonist  wrote:
> IN NEED OF EXPLANATION:
>
> class Comment < ActiveRecord::Base
>     validate :must_be_friends
>
>     def must_be_friends
>       errors.add_to_base("Must be friends to leave a comment")
>                  unless commenter.friend_of?(commentee)
>     end
> end
>
> The above code comes from rails documentation.  There is a similar
> example inAgile Web Development with Rails by Dave Thomas and Sam Ruby.
>
> my understanding is that:
>                 validate :must_be_friends
> is a method call to the validate method within the ActiveRecord::Base
> class.  Supposedly it's contents are:
>                   def validate
>                   end
>
> This of course does not work with ruby because the validate method does
> not take parameters.
>
> Is metaporgramming being used?  Tnis seems like some sort of Rails
> idiom.
>
> Please explain.
>
> I'm trying to get back into Rails after my first attempt.
>
> TIA,
> Pete
> --
> 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: best search facility

2010-01-24 Thread jemminger
Solr is a better alternative in my experience.  I've used
acts_as_solr.

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



[Rails] Re: Need a fresh start...

2009-12-15 Thread jemminger
You might also look into this:  http://www.mamp.info/en/index.html

I've never used it though.  I'm running Leopard 10.5.8 with:

$ ruby -v

ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
$ gem -v
1.3.5

--

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




[Rails] Re: Need a fresh start...

2009-12-15 Thread jemminger

> *gem -v *
> /usr/local/bin/gem:8:in `require': no such file to load -- rubygems
> (LoadError)
> from /usr/local/bin/gem:8
>
> *which gem*
> /usr/local/bin/gem
>

I'm guessing your gem install is broken.  I'd try removing/
reinstalling gem.

--

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




[Rails] Re: How can I future-proof my system for a future migration from HTTP to HTTPS???

2009-12-15 Thread jemminger
Check out the SSL Requirement plugin:
http://github.com/rails/ssl_requirement

--

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




[Rails] Re: update a field in a second model when creating a new record in a first model? is possible?

2009-12-15 Thread jemminger
update_attribute performs a save on the model.  Instead, just manually
set the property:

client.date_last_rent = rent.date
client.save ? nil : res = false


On Dec 14, 1:15 pm, "Matteo C."  wrote:
> Hi,
> i've got a little problem in my app.
> When I'm creating a new record in a model, i would like to update a
> field in a second model with the value of one of the fields of the
> first model.
>
> Example:
>
> # model Rent
> ...
> t.timestamp :date
> ...
>
> # model Client
> ...
> t.timestamp :date_last_rent
> ...
>
> When I create a new rent rent, I would like to save the rent.date
> value into client.date_last_rent. So in RentController i do this:
>
>  def create
>     @rent = Rent.new(params[:rent])
>
>     respond_to do |format|
>       if @rent.save and Client.update_date_last_rent(@rent)
>           flash[:notice] = "ok"
>            ...
>       else
>          
>          flash[:error] = "ko"
>       end
>     end
>
> In my model Client.rb I do this:
>
>   def self.update_fifo_queue(rent)
>     res = true
>
>     client = Client.find(line.rent_id)
>     client.update_attribute(:date_last_rent => rent.date)
>     client.save ? nil : res = false
>
>     return res
>   end
>
> It works, but i'm not sure about the code in case of error. If the
> rent.save fail, the client.date_last_value is modified!!
>
> How can i do to avoid this problem? I've read about after_save/
> before_save but i never used it and i can't find examples about it!
>
> Any suggestion is appreciated!
> Matteo C.

--

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




[Rails] Re: shear madness

2009-12-15 Thread jemminger


On Dec 15, 3:30 pm, Trausti Thor Johannsson 
wrote:
> You always miss out on features coming in new versions, so why get
> started with anything at anytime ?
>

Exactly.  Just get it done and working and ship it, then when that
"cool" new feature comes out you can decide if you still need it, and
refactor.

--

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




[Rails] Re: Deployment of an app that uses a big Shared library

2009-12-15 Thread jemminger
If I understand correctly, Mongrel and Passenger start multiple
instances of the Rails app, but these are long-lived.  The app
instance is not created for each request and then destroyed.


On Dec 15, 5:43 pm, PierreW  wrote:
> Hi guys,
>
> I am new to Rails, so if my assumptions below are completely wrong,
> please do let me know.
>
> My app needs to load a shared library. I use Ruby/DL to do this.
> My understanding of Rails is since it's single-threaded, the way to
> deploy an app is to use HTTP proxying to send requests that should be
> handled by Rails to one of any number of back-end application
> processes.
> Does it mean the shared library will be loaded by every single
> application process? This library is very big (and in fact takes a lot
> of time to load), hence my concern. If my assumption is correct, it
> means the app will grow far too big. Is there any way to handle this?
>
> Thanks!
> Peter

--

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




[Rails] Re: Where should I store private/restricted files?

2009-12-15 Thread jemminger

> However, these files must be private and only
> accessible by those users alone.

Store them anywhere you want, just not inside /public/

For example, store them in #{RAILS_ROOT}/user_xml_files

Then have your app access the file if the user has permission.

--

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




[Rails] Re: Newbie question: How to send an empty response?

2009-12-15 Thread jemminger
render :nothing => true

On Dec 15, 9:10 pm, tm65  wrote:
> Hi,
>
> I want to have a controller action that simply sets a few headers and
> respond without a body. [see below]. But Rails wants to load the erb
> template file for the action, which does not exist. Is there a way to
> instruct the controller to respond  without loading the template ?
>
> Thanks
>
> 
> class PortController < ApplicationController
>
>   def hello
>     method = request.request_method
>     case method
>       when :options :
>         headers['Status'] = "200 OK"
>         headers['Access-Control-Allow-Methods'] = "POST,GET"
>       when :get :
>           ...
>       when :post :
>           ...
>       else
>          ...
>     end
>   end
> end
>
> 

--

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




[Rails] Re: Simple system for asynchronous SQL queries

2009-10-20 Thread jemminger

I'd put them in a model and call them via cron, e.g.

# in app/models:
class SlowQuery < ActiveRecord::Base
  def self.some_query
self.connection.execute "my big slow SQL here"
  end
end

cron can call:

ruby script/runner "SlowQuery.some_query"


On Oct 19, 10:26 pm, Robert Matei 
wrote:
> Should note that I already have delayed_job running, but it seems a bit
> silly to create a job (in the database) that just executes a SQL query,
> even if the SQL query is running take significantly longer than creating
> the job.
>
> Robert Matei wrote:
> > There has to be something like this... I have some tracking related SQL
> > queries that are slow and don't need to happen in the request cycle. Is
> > it possible to dump them to some text file and then read them in a
> > daemon and send them to MySQL?
>
> > What would be the simplest way of implementing this?
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to configure every (postgresql) db connection?

2009-10-15 Thread jemminger

In SqlServer, in the context of a Model, you can do this:

self.connection.instance_variable_get
(:@connection).handle.instance_variable_get(:@handle).setproperty
('CommandTimeout', 300)

Perhaps there is something similar for Postgres.

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



[Rails] Re: AJAX - how to have multiple select form sets implemented?

2009-10-15 Thread jemminger


Ultimately, you're going to end up with arrays of category ids and
subcategory ids.  You'll represent these in your form with fields
named something like "category_id[]" and "subcategory_id[]".  So your
ajax call will just need to return the html to insert a new properly-
named field, or perhaps just json representing the available options
and you create the new properly named field via DOM methods.

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



[Rails] Re: Any way to avoid instantiating a class twice?

2009-10-01 Thread jemminger



> Is there any way around this situation?  Is there some way to keep the
> instantiated class alive so it can be used in subsequent actions?

Sure, for the non user-specific parts, you can lazy-load and cache:

class Expensive

  def self.share_me
@some_val ||= expensive_calculation
  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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem with environment

2009-10-01 Thread jemminger

require 'net/https'

... or else sounds like maybe ruby wasn't compiled with SSL support.


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



[Rails] Re: want to jump/scroll to a certain row in a table

2009-10-01 Thread jemminger


You're just using the wrong syntax.  Use id="event666" and link to it
like http://some/url#event666

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



[Rails] Re: how to make rails parse , , entered in text area?

2009-10-01 Thread jemminger

What version of Rails are you using?  I seem to remember discussion of
auto-escaping by default in v3, but to my knowledge and testing this
is not the case as of 2.3.4.

Check to make sure that your data is not html-escaped in the database.

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



[Rails] Re: Thin controllers and fat models

2009-09-03 Thread jemminger

No, I think the reasoning is that a model is "This is how my business
logic works", and a controller is "This is what the outside world is
allowed to requests of my models".

On Sep 3, 3:09 pm, Aldric Giacomoni 
wrote:
> I've read this a few times recently.
> I thought a model's job was only to explain "This is how I behave
> myself" and the controller's job was to explain "This is what I do".
> Is this basically right? So why do people want to stuff more and more
> stuff in the model?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Will Rails be able to do this -fast- ?

2009-09-03 Thread jemminger

You keep saying "every millisecond counts", yet your requirement was
given basically as "I need an F1 racecar, here take this bicycle and
build me one" to which you responded "I'm more familiar with mopeds,
I'll use that instead".

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



[Rails] Re: The error occurred while evaluating nil.chop

2009-06-03 Thread jemminger


On Jun 3, 10:56 am, jemminger  wrote:
> Don't cd into the script dir, instead call it from the project root:
>
> ruby script/server
>

Actually that doesn't seem to matter - the problem is that you're
trying to call chop() on nil here:

C:/cairns/cairns/cairns/app/models/node.rb:60:in `initialize'

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



[Rails] Re: The error occurred while evaluating nil.chop

2009-06-03 Thread jemminger

Don't cd into the script dir, instead call it from the project root:

ruby script/server

On Jun 2, 11:46 pm, Yasir  wrote:
> Hi,
>
> I am new to Ruby, while running a project I get the following errors:
>
> C:\cairns\cairns\cairns\script>ruby server
> => Booting WEBrick...
> server: No such file or directory - uname
> C:/cairns/cairns/cairns/app/models/node.rb:74:in `get_hostname': You
> have a nil
> object when you didn't expect it! (NoMethodError)
> The error occurred while evaluating nil.chop
>         from C:/cairns/cairns/cairns/app/models/node.rb:60:in
> `initialize'
>         from ./../config/../config/environment.rb:65:in `new'
>         from ./../config/../config/environment.rb:65
>         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> 31:in `ge
> m_original_require'
>         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> 31:in `re
> quire'
>         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
> active_suppo
> rt/dependencies.rb:495:in `require'
>         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
> active_suppo
> rt/dependencies.rb:342:in `new_constants_in'
>         from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
> active_suppo
> rt/dependencies.rb:495:in `require'
>          ... 6 levels...
>         from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/
> server.rb:3
> 9
>         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> 31:in `ge
> m_original_require'
>         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> 31:in `re
> quire'
>         from server:3
>
> Need Help!
>
> Kind Regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Polymorphism question

2009-06-03 Thread jemminger


One of the existing plugins such as acts_as_taggable_on_steroids might
have this functionality already... I'm not sure though.

Here's one way to do it:

class Blog < ActiveRecord::Base
  has_many :taggings, :as => :taggable
  has_many :tags, :through => :taggings
end

class Tagging < ActiveRecord::Base
  belongs_to :tag
  belongs_to :taggable, :polymorphic => true
end

class Tag < ActiveRecord::Base
  has_many :taggings

  def get(taggable)
self.taggings.all(:conditions => ["taggable_type = ?",
taggable.to_s.singularize.camelize]).map(&:taggable)
  end
end
require 'test_helper'

class TagTest < ActiveSupport::TestCase

  test 'should get taggable type' do
tag = Tag.create(:name => 'blogtag')
blog1 = Blog.create(:name => 'blog1')
blog1.tags << tag
blog2 = Blog.create(:name => 'blog2')
blog2.tags << tag

assert_equal [tag], blog1.tags
assert_equal [blog1, blog2], tag.get(:blogs)
  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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Add rake task to default

2009-04-23 Thread jemminger

When I run "rake" at the root of my rails app, I want it to include a
custom rake task.  How do I hook my custom rake task into the Rails
default rake task so that it runs automatically?

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



[Rails] Re: InstantRails and new gems

2009-03-23 Thread jemminger

perhaps you need

  require 'wxruby2'

in your code?  or maybe

  require 'rubygems'
  require 'wxruby2'


On Mar 23, 1:08 am, Pierre Pierre 
wrote:
> Folks,
>
> I'm not sure this is the best place to ask the following question, but
> someone might still know the answer.
>
> I currently can't install anything on this computer (hence no ruby
> interpreter), I thought about getting InstantRails with which you can
> open a console with ruby running.
> I also wanted to add a new gem (wxruby2), I could install the gem
> correctly but when I run my code, it'll tell me: no such file to load --
> wxruby2 (LoadError)
>
> Anyone has an idea how I can install (and use) new gems with
> InstantRails?
>
> Cheers
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: find :all using :group

2009-03-23 Thread jemminger

This sounds right to me... find the SQL it generated in your .log and
execute it in a mysql console... is the output the same?


On Mar 23, 10:21 am, Ayeye Brazov 
wrote:
> hello,
>
> I need to group Users depending on their operating systems field "os",
> so I tried
>
> User.find(:all, :group => :os)
>
> however, the result is an array having only one user for each os group.
> I'd like to have ALL the users grouped  by :os though
>
> One solution is to write
>
> User.find(:all).group_by{|u| u.os}
>
> However, I wonder if it could be done within the "find" method ?
>
> thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: mysql error on scoped find_or_create_by_attr

2009-03-23 Thread jemminger

The name 'foobar' exists already?


On Mar 23, 1:36 pm, klochner  wrote:
> Anyone have insight on this one?
>
> class Parent
>   has_many :children
> end
>
> add_index "children", ["parent_id", "name"], :name =>
> "by_parent_name", :unique => true
>
> a = Parent.find(1)
> a.children.find_or_create_by_name "foobar"
>
> Mysql::Error: Duplicate entry 'foobar' for key 2: INSERT INTO
> `children` (`name`, `updated_at`,  `parent_id`, `created_at`) VALUES
> ("foobar", '2009-03-23 17:25:39', 1,  '2009-03-23 17:25:39')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Secure but elegant destruction method

2009-02-25 Thread jemminger

I don't see anything wrong with this.  I'd only resort to a filter if
it was going to be used by multiple actions.

On Feb 25, 11:02 am, Vahagn Hayrapetyan  wrote:
> Sorry, the code should have been:
>
>  def destroy
>     @user = User.find(params[:id])
>     if @user == logged_in_user or
> logged_in_user.has_role?('administrator')
>       if @user.destroy
>         flash[:notice] = "User deleted"
>       else
>         flash[:error] = "There was a problem deleting this user."
>       end
>       redirect_to :action => 'index'
>     end
>   end
>
> / V.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error accessing db through model - Rails 2.2.2, MySql 5.1.30

2009-02-25 Thread jemminger

Have you created the database and migrated?


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



[Rails] Re: Unable to set the replay-to in ActionMailer

2009-02-24 Thread jemminger


> I use Citadel (www.citadel.org).
> --

I would check with them to see why they are overwriting the Reply-to
header.

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



[Rails] Re: Free SMS limit (using sms_fu)

2009-02-24 Thread jemminger



On Feb 24, 9:34 pm, Dave L  wrote:
> Thanks for the info.  Have you ever come across some concrete numbers
> given by cell phone companies or is this all through experience?
>

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



[Rails] Re: Unable to set the replay-to in ActionMailer

2009-02-24 Thread jemminger

Ah - what smtp server are you using


On Feb 24, 11:26 am, Fernando Perez 
wrote:
> Jeff Emminger wrote:
> > That very document states:
>
> >> reply_to - Takes one or more email addresses. These addresses will be 
> >> listed as the default recipients when replying to your email. Sets the 
> >> Reply-To: header.
>
> As I said I can't make it work, the email address used to connect to my
> smtp server constantly over-writes or takes precedence over the reply_to
> option. I tried setting the headers too, but still no luck.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Mysql::Error: Duplicate entry '#' for key # - Error with the test framework or ActiveRecord???

2009-02-24 Thread jemminger

Can you post the code for both models and your test?


On Feb 19, 2:10 am, "lee.longm...@googlemail.com"
 wrote:
> Thanks for your reply...
>
> I have not created a fixture for one of the models that has the HABTM
> association or for the join table itself, although I do have a fixture
> for the model on the other side of the HABTM. Is it necessary to
> create fixtures for each?
>
> fyi, the model under test has methods whose job it is to populate the
> model's table and the join table with reference data, and I am trying
> to test that these methods work. Hence I saw no need to create fixture
> data for the model and join table.
>
> On 18 Feb, 22:00, jemminger  wrote:
>
> > Sounds like it's trying to insert (140, 2) twice.  Are your fixtures
> > set up with unique ID's for each fixture record?
>
> > On Feb 18, 12:53 pm, "lee.longm...@googlemail.com"
>
> >  wrote:
> > > I am getting the following error during testing of my application
> > > (using the Rails testing framework):
>
> > > Mysql::Error: Duplicate entry '140-2' for key 1: INSERT INTO
> > > `accessibilities_member_entities` (`accessibility_id`,
> > > `member_entity_id`) VALUES (140, 2)
>
> > > The error occurs when I try to save two model objects where the model
> > > has the following HABTM association:
>
> > > has_and_belongs_to_many   :member_entities,
> > >                                                :class_name =>
> > > "MemberEntity",
> > >                                               :join_table =>
> > > "accessibilities_member_entities",
> > >                                               :foreign_key =>
> > > "accessibility_id",
> > >                                               :association_foreign_key
> > > => "member_entity_id"
>
> > > The two objects are distinct from each other and I would therefore
> > > expect ActiveRecord to generate a different value for accessibility_id
> > > in each row. I would expect member_entity_id to be the same value in
> > > each row. There is a compound primary key defined for the join table
> > > (accessibility_id + member_entity_id). The accessibility_id and
> > > member_entity_id database columns are defined as INT.
>
> > > My debugging has been fruitless and the objects seem fine before the
> > > save. Is this an error in the Rails testing framework or Active
> > > Record? I am using test fixtures etc to test my code.
>
> > > My application is running on Rails 2.2.2 and MySQL 5.0.51 (for
> > > Ubuntu).
>
> > > Any help/ideas much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Unable to set the replay-to in ActionMailer

2009-02-24 Thread jemminger

That very document states:

> reply_to - Takes one or more email addresses. These addresses will be listed 
> as the default recipients when replying to your email. Sets the Reply-To: 
> header.


You should be able to like so:

 class Notifier < ActionMailer::Base
   def signup_notification(recipient)
 recipients recipient.email_address_with_name
 from   "sys...@example.com"
 reply_to  "ot...@example.com"
 subject"New account information"
 body   :account => recipient
   end
 end




On Feb 23, 5:49 pm, Fernando Perez 
wrote:
> Hi,
>
> Users can contact me through a form that sends emails through
> ActionMailer, the problem is that I can't set "reply_to", and the "from"
> is actually set to my account on the server which sends the email, so I
> have to copy and paste the user email which is saved in the body in the
> reply of my mail client and that's painful.
>
> Has anyone been able to set the reply_to option?
>
> http://api.rubyonrails.com/classes/ActionMailer/Base.htmlis rather thin
> on instructions on how to do that? Or did they skip it on purpose?
>
> I also tried setting: headers 'reply-to' => email, 'Reply-ro' => email,
> but none worked.
>
> Best regards,
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Error going through the "Getting Started" tutorial

2009-02-24 Thread jemminger

This is an edge rails feature AFAIK, supposed to be in 2.3


On Feb 24, 3:21 am, Beren  wrote:
> Hi,
>
> I get this error on step 9 of the Getting Started tutorial:
>
> NoMethodError in PostsController#index
>
> undefined method `accepts_nested_attributes_for' for # 0x23fbc48>
>
> Does someone know if it's a bug?
>
> Cheers,
>
> Beren
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Free SMS limit (using sms_fu)

2009-02-24 Thread jemminger

Depends on the carrier in my experience.  Some seem to have a hard
limit of "X per hour", some seem to have a similar limit but relax it
if you have a good senderbase reputation, some don't seem to limit at
all.


On Feb 24, 7:00 am, David  wrote:
> I have been using SMS_fu but it seems too good to be true for
> production.  I'm wondering, is there any sort of limit on email to sms
> depending on the carrier that you can send in a given amount of time?
> I remember reading somewhere that there is a limit to the number of
> free email to sms that you can send through AT&T in a given month.
> Does anyone know anything aobut this?  I guess I can believe that it
> is totally free b/c the receiver is still paying, but I have googled
> and cannot find any concrete answers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to...Have a proxy URL...

2009-02-24 Thread jemminger

You need to run it behind a webserver such as apache or nginx

Google rails + mongrel + apache

or rails + nginx

or rails + passenger



On Feb 24, 8:13 am, Jeba Momin 
wrote:
> Hi..
> My application can be accessed at:http://localhost:3001/main/home?locale=en-US
>
> I'm running it on mongrel server..
> Also I need to pass the locale parameter...only the first time...
>
> But I want my URL to be more user friendly as:http://myapplication.com
>
> Can anyone please tell me how do I 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Framework

2009-02-24 Thread jemminger

I believe I had a similar problem once, either caused by multiple
versions of Rails installed or by having some version of Rails frozen
into vendor/rails

My solution was to remove the offending version since I wasn't locked
to a specific version.



On Feb 19, 2:56 pm, "spud...@gmail.com"  wrote:
> should I remove or downgrade any versions that are 2.2.2? If so how
> would I uninstall and reinstall because I installed everything threw
> macports
>
> On Feb 19, 11:14 am, "spud...@gmail.com"  wrote:
>
> > ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
> > gem -v 1.3.1
>
> > actionmailer (2.2.2, 2.1.0)
> > actionpack (2.2.2, 2.1.0)
> > activerecord (2.2.2, 2.1.0)
> > activeresource (2.2.2, 2.1.0)
> > activesupport (2.2.2, 2.1.0)
> > acts_as_ferret (0.4.3)
> > addressable (2.0.2)
> > capistrano (2.5.4)
> > daemons (1.0.10)
> > data_objects (0.9.11)
> > dnssd (0.7.0)
> > extlib (0.9.10)
> > ferret (0.11.6)
> > highline (1.5.0)
> > hpricot (0.6.164)
> > libxml-ruby (0.9.8)
> > mongrel (1.1.5)
> > net-scp (1.0.2)
> > net-sftp (2.0.2)
> > net-ssh (2.0.10)
> > net-ssh-gateway (1.0.1)
> > rails (2.2.2, 2.1.0)
> > rake (0.8.3)
> > RedCloth (4.1.1)
> > ruby-openid (2.1.4)
> > rubynode (0.1.5)
>
> > On Feb 17, 10:56 am, jemminger  wrote:
>
> > > Show:
>
> > > ruby -v
> > > gem -v
> > > gem list
>
> > > On Feb 16, 10:49 pm, "spud...@gmail.com"  wrote:
>
> > > > When I try to create new rails framework I' getting the follow error.
> > > > I've had to reinstall ruby and ruby gem.
>
> > > > /Library/Ruby/Site/1.8/rubygems.rb:149:in `activate': can't activate
> > > > activesupport (= 2.1.0, runtime), already activated
> > > > activesupport-2.2.2 (Gem::Exception)
> > > >         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in
> > > > `require'
> > > >         from 
> > > > /Users/brianspadetti/.gem/ruby/1.8/gems/rails-2.2.2/bin/../lib/
> > > > rails_generator.rb:28
> > > >         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> > > > `gem_original_require'
> > > >         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> > > > `require'
> > > >         from 
> > > > /Users/brianspadetti/.gem/ruby/1.8/gems/rails-2.2.2/bin/rails:13
> > > >         from /usr/bin/rails:19:in `load'
> > > >         from /usr/bin/rails:19
> > > > Please help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: consult BD oracle

2009-02-24 Thread jemminger

Wait, by "view" do you mean an Oracle view (like a table) or a Rails
view (like an erb template)

On Feb 19, 9:01 am, Enoc Montero 
wrote:
> correct!
> This is the model for q Cree consultation:
>
> class Re_tmtinv 
>     establish_connection (
>         : adapter => "oracle"
>         : host => "localhost"
>         : username => "root",
>         : password => "*",
>         : database => "*"
>         )
> # Validations
>
>    validates_uniqueness_of: mtin_mtin,: message => "The code that this
> trying to view does not exist in the system. "
>
>       end
>
> but still can not get the view mostralo q e created.
>
> perhaps a problem in my view.
>
> Thanks for the help.
> Greetings.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: capistrano equivalent for *nix -> Windows deployment

2009-02-24 Thread jemminger

There's apparently a Windows + Rsync recipe here:

http://wiki.rubyonrails.com/rails/pages/HowtoUseRsyncToDeployYourApplication


On Feb 18, 5:42 pm, Hassan Schroeder 
wrote:
> On Wed, Feb 18, 2009 at 2:28 PM, jemminger  wrote:
>
> > Install TortoiseSVN on the target box, check out your project there &
> > just do an svn update
>
> We're using git, not subversion, but maybe that's an approach.
>
> Mostly hoping to find a command-line solution that doesn't involve
> all that clumsy remote-desktop nonsense, but beginning to think
> that's a dream :-)
>
> Thanks though!
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: capistrano equivalent for *nix -> Windows deployment

2009-02-18 Thread jemminger

Install TortoiseSVN on the target box, check out your project there &
just do an svn update

On Feb 17, 7:54 pm, Hassan Schroeder 
wrote:
> I have a (hopefully short-term) need to deploy a small Rails app to a
> Windows XP box.
>
> It's installed and working fine, but I'll be needing to make updates
> and enhancements, and would like to be able to do the equivalent of
> `cap deploy` and have it "just happen."
>
> Any suggestions?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to convert xls to csv?

2009-02-18 Thread jemminger

google "ruby excel"

On Feb 17, 11:54 pm, Salil Gaikwad 
wrote:
> How to access row value using spreadsheet?
> How to find last row or end of file using roo?
> How to convert xls to csv?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: form_tag help needed

2009-02-18 Thread jemminger

1.  Request is a reserved word in Rails; you must choose another name
for your model.

2.  If you're using RESTful controllers (as Rails scaffolding does by
default) then your forms will POST to the plural form of your model,
for example a Blog would POST to /blogs to create.  Rails controllers
understand the REST verbs.



On Feb 18, 5:20 am, Sijo Kg  wrote:
> Hi
>     I have created a model Request and after that created the controller
> for that with the name Request .I have also added in routes.rb
> map.resources :reuests
>
>    Now in app/view/requests/new.html.erb  I have
>
> <% form_tag @onboarding_request do |f| %>
> <% f.submit "Create" %>
> <%end %>
>
>          But this goes to the index action of requestscontroller not to
> the create action But in the view source it is getting as method="post"
>
>       What is the problem here..Why this not going to the create
> action?Please help
>
> Thanks in advance
> Sijo
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails erb in inline CSS(in layout file)

2009-02-18 Thread jemminger

I don't think you want to put an image tag there, probably just
something like this instead:



#header {
background: url(<%= @customer_logo.path_to_logo_image %>)
no-repeat;
}



On Feb 18, 10:30 am, "Srinath A." 
wrote:
> Hi,
> but i code like this :
>
> 
>         #header {
>             background:
> url(<%= image_tag(@customer_logo.path_to_logo_image, :width => 250,
> :height => 100) %>) no-repeat;
>             }
>     
>
> this is producing error...
>
> Jeff Emminger wrote:
> > Exactly as you described should work.
>
> > On Feb 18, 10:17 am, "Srinath A." 
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: why is user/new redirecting to sessions/new and then looping?

2009-02-18 Thread jemminger

Is there maybe a before_filter to redirect to the login page when not
logged in?

On Feb 18, 10:44 am, Brian  wrote:
> I've started out my new rails app by setting up users and sessions by
> following the example in the FlexibleRails book.  This uses the
> restful_authentication plugin.  It then generates users sessions and
> sets up basic routes like
>
> map.resources :users
>   map.resource :session
>
>   map.signup '/signup', :controller => 'users', :action => 'new'
>   map.login '/login', :controller => 'sessions', :action => 'new'
>   map.logout '/logout', :controller => 'sessions', :action =>
> 'destroy'
>
> After setting all that up I tested it manually and ran rake to run the
> tests, and everything worked fine.
>
> Then I started generating my scaffolds and models, and probably waited
> too long to run tests again.  Now when I run rake, I get a bunch of
> errors in UserController and SessionController.  In addition, when I
> go to localhost:3000/signup, which is supposed to take me to the
> generated new user screen, I get an infinite redirect to session/new.
> Here's the log for the signup page:
>
> Processing UsersController#new (for 127.0.0.1 at 2009-02-18 10:07:57)
> [GET]
>   Session ID:
> BAh7BzoOcmV0dXJuX3RvIhEvc2Vzc2lvbi9uZXciCmZsYXNoSUM6J0FjdGlv%0AbkN
> vbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA%3D--
> a1d287f3622f9cc0c08e2f5
> 7691a42ef83a3e811
>   Parameters: {"action"=>"new", "controller"=>"users"}
>   ←[4;36;1mSQL (0.00)←[0m   ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m
> Redirected tohttp://localhost:3000/session/new
> Completed in 0.00010 (1 reqs/sec) | DB: 0.0 (0%) | 302 Found
> [http://localhost/signup]
>
> Processing SessionsController#new (for 127.0.0.1 at 2009-02-18
> 10:07:57) [GET]
>   Session ID:
> BAh7BzoOcmV0dXJuX3RvIgwvc2lnbnVwIgpmbGFzaElDOidBY3Rpb25Db250%0Acm9
> sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--
> c95428aa8926994b68c56d23ff54ca430
> cd6263a
>   Parameters: {"action"=>"new", "controller"=>"sessions"}
> Redirected tohttp://localhost:3000/session/new
> Completed in 0.00010 (1 reqs/sec) | DB: 0.0 (0%) | 302 Found
> [http://localhost/session/new]
>
> I'm not sure what that 'SET SQL_AUTO_IS_NULL' is or if it's normal or
> not.  I googled it but didn't find anything relevant.
>
> The UsersController class only defines an empty method for new, so
> it's suppose to show the new.rhtml, right?  Why is it redirecting to
> the session controller?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Mysql::Error: Duplicate entry '#' for key # - Error with the test framework or ActiveRecord???

2009-02-18 Thread jemminger

Sounds like it's trying to insert (140, 2) twice.  Are your fixtures
set up with unique ID's for each fixture record?


On Feb 18, 12:53 pm, "lee.longm...@googlemail.com"
 wrote:
> I am getting the following error during testing of my application
> (using the Rails testing framework):
>
> Mysql::Error: Duplicate entry '140-2' for key 1: INSERT INTO
> `accessibilities_member_entities` (`accessibility_id`,
> `member_entity_id`) VALUES (140, 2)
>
> The error occurs when I try to save two model objects where the model
> has the following HABTM association:
>
> has_and_belongs_to_many   :member_entities,
>                                                :class_name =>
> "MemberEntity",
>                                               :join_table =>
> "accessibilities_member_entities",
>                                               :foreign_key =>
> "accessibility_id",
>                                               :association_foreign_key
> => "member_entity_id"
>
> The two objects are distinct from each other and I would therefore
> expect ActiveRecord to generate a different value for accessibility_id
> in each row. I would expect member_entity_id to be the same value in
> each row. There is a compound primary key defined for the join table
> (accessibility_id + member_entity_id). The accessibility_id and
> member_entity_id database columns are defined as INT.
>
> My debugging has been fruitless and the objects seem fine before the
> save. Is this an error in the Rails testing framework or Active
> Record? I am using test fixtures etc to test my code.
>
> My application is running on Rails 2.2.2 and MySQL 5.0.51 (for
> Ubuntu).
>
> Any help/ideas much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: again and again: no such file to load -- mysql

2009-02-18 Thread jemminger

Try this:

http://hivelogic.com/articles/2007/02/ruby-rails-mongrel-mysql-osx


On Feb 18, 3:16 am, zaqwery  wrote:
> Hello!
> I've got same problem! Can't continue working with Rails!
> I have OSX 10.5.6. Mysql 5.0.67, Latest Ruby , Rubygems, Rails 2.2.2,
> and mysl gem 2.7 installed in this way
> sudo env ARCHFLAGS="-arch i386" gem install mysql --  --with-mysql-
> dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib   --with-
> mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/
> mysql/bin/mysql_config
>
> when I do rake db:migrate
>
> !! The bundled mysql.rb driver has been removed from Rails 2.2. Please
> install the mysql gem and try again: gem install mysql.
> rake aborted!
> no such file to load -- mysql
>
> I've been googling for 3 days and none of the solutions work for me.
> I've reinstalled mysql ,ruby and rails several times got same
> error. Please help!
> Thanks beforehand
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: wrong number of arguments (1 for 0)

2009-02-18 Thread jemminger

change
  session(:cart).nil?

to
  session[:cart].nil?

session is not a method call

On Feb 18, 12:30 pm, Sony Sebastian 
wrote:
> Hello,
>         I am new to ruby on rails. When I tried to create a session I am
> getting an error, 'wrong number of arguments (1 for 0)', in my
> controller.
>
> 
>  ArgumentError in CustomerController#add_to_cart
>
> wrong number of arguments (1 for 0)
>
> RAILS_ROOT: /project/bob_shopping
> Application Trace | Framework Trace | Full Trace
>
> app/controllers/customer_controller.rb:36:in `session'
> app/controllers/customer_controller.rb:36:in `add_to_cart'
>
> 
>
> My controller is ...
>
> def add_to_cart
>     if request.post?
>       product_id    = params[:product_id]
>       quantity = params[:quantity]
>       account = get_account()
> error)---> session[:cart] = SessionCart.new(account) if
> session(:cart).nil?
>       session[:cart].add_product( product_id)
>       if quantity >= 2 and quantity <= 50
>         for i in 1..quantity-1
>           session[:cart].add_product(product_id)
>         end
>       end
>       flash[:notice] = 'Your order has been placed.'
>       redirect_to :action=>'index' and return true
>     end
>   end
>
> ~~
>
> Waiting for your valuable reply..
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: consult BD oracle

2009-02-18 Thread jemminger

I'm not sure I understand:

You're using MySQL.
You want to read a value from a field in an Oracle database.
You want to put that value into a different field on the same Oracle
table?
You want to display the result in a view?

Is this correct?


On Feb 18, 8:53 am, Enoc Montero 
wrote:
> hello everyone, the problem is the following application and made his
> and it works very well with mSQL, but I need to consult a table that is
> in
> oracle, then add to consult the same table in a field
> different and Oracle made this just can not show on
> my view is the field that I need to say that the data already inside ..
> and conultado
> ROR several tutorials and books and could not solve ..
>
> thanks in advance.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validates_inclusion_of using model association?

2009-02-18 Thread jemminger


try

validates_inclusion_of :coupon, :in => lambda { |prod| prod.coupons.map
(&:code) }

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



[Rails] Re: Rails erb in inline CSS(in layout file)

2009-02-18 Thread jemminger

Exactly as you described should work.

On Feb 18, 10:17 am, "Srinath A." 
wrote:
> Hi,
> How can we call rails erb tag in inline CSS
> app/layouts/base_layout.rhtml:
>
>         
>     
>         #header {
>             background:
> url(http://www.google.ca/intl/en_in/images/logo.gif) no-repeat;
>             }
>     
>     
>         
>
> I want to replace url(http://www.google.ca/intl/en_ca/images/logo.gif)
> with
> <%= image_tag(@customer_logo.path_to_logo_image, :width => 250, :height
> => 100) %> with out keeping #header in .css file
>
> any help
>
> thanks !!
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How do you ignore a URI prefix?

2009-02-17 Thread jemminger

This is a problem with your Passenger configuration, not Rails.


On Feb 16, 7:46 pm, David Beckwith  wrote:
> I'm using the directive RailsBaseURI to point to an application called
> myapp from my site davidbeckwith.com.  When I use the browser to point
> to davidbeckwith.com/myapp, I get a routing error because the URI
> begins with /myapp.
>
> How do I configure routes.rb or the Rails
> application to ignore the "/myapp" part of the URI so that I don't
> have to rewrite all of my routes?
>
> Thank you,
>
> David :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Framework

2009-02-17 Thread jemminger

Show:

ruby -v
gem -v
gem list


On Feb 16, 10:49 pm, "spud...@gmail.com"  wrote:
> When I try to create new rails framework I' getting the follow error.
> I've had to reinstall ruby and ruby gem.
>
> /Library/Ruby/Site/1.8/rubygems.rb:149:in `activate': can't activate
> activesupport (= 2.1.0, runtime), already activated
> activesupport-2.2.2 (Gem::Exception)
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in
> `require'
>         from /Users/brianspadetti/.gem/ruby/1.8/gems/rails-2.2.2/bin/../lib/
> rails_generator.rb:28
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>         from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `require'
>         from /Users/brianspadetti/.gem/ruby/1.8/gems/rails-2.2.2/bin/rails:13
>         from /usr/bin/rails:19:in `load'
>         from /usr/bin/rails:19
> Please help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Without the magical id column in table

2009-02-17 Thread jemminger

You can use a UUID instead... never used it myself though.

google "rails uuid"



On Feb 17, 5:10 am, Valentino Lun 
wrote:
> Dear all
>
> In rails, the are some magical column such as id, created_at, updated_at
> can make things easier.
>
> However, within my organization, due to whatever reason, the data type
> identity is not allowed to use. So, the magical id column cannot be used
> in my rails project. I know that there is some actions rely on the 
> likehttp://localhost:3000/controller/action/123, where 123 is the :id...and
> in edit_path(:id), It seems that without the id column I cannot perform
> these actions.. Am I right?
>
> Should I change other web framework in my project (but I love rails
> ^_^)? Or any workaround available in rails if my table without the id
> column? Is it really a matter for the CRUD action without id column?
>
> Please give me some advices.
>
> Thank you.
>
> Valentino
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Assign sysdate instead of the result of DateTime::now()

2009-02-17 Thread jemminger

Is the issue that the app server time is inconsistent with the
database server, or is it a time zone issue?  If it's the latter, I
would suggest you store all dates as GMT and just let rails set
created_at and updated_at for you automatically.


On Feb 17, 5:04 am, Florent Guiliani 
wrote:
> Hi rails devs,
>
> I've put the following code in a model:
>
>     protected
>       def validate
>         self[:lastupdate] = DateTime::now()
>       end
>
> I wonder how I could get "sysdate" instead of the result of
> DateTime::now() in the generated SQL request. The goal is to get the
> database server time and not the application server time. You've
> already figure out that I'm using Oracle ;).
>
> I have 2 solutions:
>    - hack quote() into OracleAdapter
>    - add a trigger directly on the oracle table
>
> Is somebody would have a better solution?
>
> Regards,
> --
> Florent,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: trouble with routes...

2009-02-16 Thread jemminger

That's a rather strange error considering you're not even trying to
redirect to :show after an update, but rather just :index.

Further strange are the actions it says are valid:
check_authorization, create,
destroy, edit, index, logged_in?, make_profile_vars, nav_link, new,
paginate, paginated?, param_posted?, protect, show, text_field_for,
and update

What is the URL that results in this error?  Do you have some other
plugins that might be adding these other actions?


On Feb 16, 7:14 pm, bearblu  wrote:
> The edit action is:
>
>   def edit
>     @title = "Pinnacle Harvest: Edit Vendor"
>     @vendor = Vendor.find(params[:id])
>   end
>
> the update action is:
>
>   def update
>     raise params.inspect
>     @vendor = Vendor.find(params[:id])
>
>     respond_to do |format|
>       if @vendor.update_attributes(params[:vendor])
>         flash[:notice] = 'Vendor was successfully updated.'
>         format.html { redirect_to :action => 'index' }
>         format.xml  { head :ok }
>       else
>         format.html { render :action => "edit" }
>         format.xml  { render :xml => @vendor.errors, :status
> => :unprocessable_entity }
>       end
>     end
>   end
>
> the edit.html.erb file is:
> <% form_for :vendor do |form| %>
> 
>   <%= @title %>
>
>   <%= error_messages_for 'vendor' %>
>   <%= text_field_for form, "name" %>
>   <%= text_field_for form, "city" %>
>   <%= text_field_for form, "state" %>
>   <%= text_field_for form, "zip_code", ZIP_CODE_LENGTH %>
>   <%= text_field_for form, "phone_number" %>
>   <%= text_field_for form, "fax_number" %>
>   <%= text_field_for form, "web_url" %>
>
>   <%= submit_tag "Update", :class => "new_client_vendor_submit" %>
> 
> <% end %>
>
> There is nothing fancy, I am pretty much a novice at Rails. ;-)
>
> Rick
>
> On Feb 16, 4:05 pm, jemminger  wrote:
>
> > Show us your action.
>
> > On Feb 16, 7:03 pm, bearblu  wrote:
>
> > > I just started working with Rails 2.2.2 and I don't seem to be having
> > > much luck with the new routing scheme.  When I try to edit a record
> > > and save it I get and error message that looks as though it is trying
> > > to use the id for the action. So just what am I doing wrong?
>
> > > No action responded to 8. Actions: check_authorization, create,
> > > destroy, edit, index, logged_in?, make_profile_vars, nav_link, new,
> > > paginate, paginated?, param_posted?, protect, show, text_field_for,
> > > and update
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How do you check if associated table is empty from find?

2009-02-16 Thread jemminger

You could add a :counter_cache to your model if you want a simple
solution:

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html


On Feb 16, 8:36 pm, Bob Sanders 
wrote:
> So I have two tables:
>
> - teams
> - players
>
> I'm trying to find all teams that have no players. I thought this could
> work:
>
> Team.find(:all, :joins => :players, :conditions => ["players.size = ?",
> 0] )
>
> Of course that's not working for me because I'm mixing the SQL with
> Rails. Do you know the proper way to find all teams that have no
> players?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Referencing a non-ActiveRecord attribute

2009-02-16 Thread jemminger


On Feb 16, 12:14 am, rapdup  wrote:
> Okay, I found a solution. It isn't very readable, but it works:
>
> user = User.new(:login=> "foo", :password=>"bar")  # :password is not
> a column in the db, but defined in the model using
> "attr_accessor :password" (see initial post)
> [:login, :password].each do |x|
>     getter = x     # => :password
>     setter = (x.to_s << "=").to_sym    # => :password=
>     original_val = user.method(getter).call
>     user.method(setter).call(some_new_val)
>     do_some_test(user)
>     user.method(setter).call(original_val)
> end
>
> Any clean up suggestion?

This is marginally cleaner IMO:


[:login, :password].each do |getter|
setter = "#{getter}="
original_val = user.send(getter)
user.send(setter, some_new_val)
do_some_test(user)
user.send(setter, original_val)
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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What happen when a controller raises a custom exception ?

2009-02-16 Thread jemminger

Try rescue_from:
http://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html#M000978


On Feb 16, 6:20 am, Bob Mundane 
wrote:
> Hello, some controllers of mine raises security exception.
>
> environments/test.rb defines
>  config.action_controller.consider_all_requests_local = true
>
> 1) I want to raise from a controller, and have the exception visible in
> test, inside assert_raise blocks but I don't.
>
> 2) I defined rescue_action_in_public() which (I'm sure) is not called
> during tests.
>
> 3) But during tests, when my controller raises
> AppException::SecurityError it is not caught by the assert_raise block.
>
> So I added this, to see what happens :
>
> def rescue_action_locally(exception)
>   p exception
>   raise exception
> end
>
> The exception is well printed on console but re-raising lead to Class:
> 
> Message: <"You have a nil object when you didn't expect it!\nYou might
> have expected an instance of ActiveRecord::Base.\nThe error occurred
> while evaluating nil.[]=">
>
> I really don't understand what happen because after re-raising no code
> of mine is running, it leave my scope ...
>
> So I wonder how to have these exceptions visible in test ?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: testing: switch on all caching?

2009-02-16 Thread jemminger



On Feb 16, 4:58 pm, itsastickup  wrote:
> I would like to speed up my tests and I've noticed that not all
> caching is switched on in test.rb, and can't think why not.
>
> I've thought to do this:
>
> config.cache_classes = true
> config.action_controller.perform_caching             = true
> config.action_view.cache_template_loading            = true
>
> Good idea?

Try it and find out.  Think about what might go wrong:  do you have
tests expecting some behavior that caching might interfere with?

Also, I have some pretty big test suites, but they run in 1- 2 minutes
at most.  How long are yours taking?  Is it perhaps inefficient code?

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



[Rails] Re: trouble with routes...

2009-02-16 Thread jemminger

Show us your action.


On Feb 16, 7:03 pm, bearblu  wrote:
> I just started working with Rails 2.2.2 and I don't seem to be having
> much luck with the new routing scheme.  When I try to edit a record
> and save it I get and error message that looks as though it is trying
> to use the id for the action. So just what am I doing wrong?
>
> No action responded to 8. Actions: check_authorization, create,
> destroy, edit, index, logged_in?, make_profile_vars, nav_link, new,
> paginate, paginated?, param_posted?, protect, show, text_field_for,
> and update
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails startup error in segments.rb

2009-02-03 Thread jemminger

http://letmegooglethatforyou.com/?q=ruby+warning%3A+encoding+option+is+ignored+-+N


On Feb 2, 5:16 am, Alex Sokoloff  wrote:
> => Booting WEBrick...
> /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.2.2/lib/
> action_controller/routing/segments.rb:6: warning: encoding option is
> ignored - N
> => Rails 2.2.2 application started onhttp://0.0.0.0:3000
> => Ctrl-C to shutdown server; call with --help for options
> [2009-02-02 12:03:54] INFO  WEBrick 1.3.1
>
> Can anyone explain me what exactly it means ? Ruby 1.9.1 on cygwin. On
> Ruby 1.8.7 Rails started without this error.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rake db:migrate should run for all environements

2009-02-03 Thread jemminger

Because maybe you don't want it to happen all at once, maybe you need
to stage things.  Imagine you're developing new features for an
existing system, and you create some destructive migrations.  You want
those to automatically affect your other environments when you might
not even be done writing and testing code?

A better idea is to realize that these processes are separate and
manual and get in the habit of doing it yourself.   Plus, if you just
use "rake" instead of running a specific test, rake will warn you that
you have pending migrations.


On Feb 2, 5:47 pm, Fernando Perez 
wrote:
> Or at least development and test. How many times did I find myself
> banging my head on the table with buggy tests until I figured out that I
> had forgotten to migrate the test database.
>
> Why rake db:migrate doesn't by default migrate all environments at the
> same time?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: protect to_xml and/or disabled other format

2009-02-03 Thread jemminger

one way would be a before_filter, e.g.


class ApplicationController < ActionController::Base

  before_filter :trap_xml

  def trap_xml
if params[:format] == 'xml' && params[:action] != 'my_xml_action'
  redirect_to :controller => 'my_xml_controller', :action =>
'my_xml_action'
end
  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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: does ActiveScaffold support multiple joins? (i.e. in the ":joins => ..." part of a find)

2009-02-03 Thread jemminger

Read the "Table Aliases" part of

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html



On Feb 3, 6:54 am, Greg Hauptmann 
wrote:
> Hi,
>
> Does ActiveScaffold support multiple joins?  (i.e. in the ":joins =>
> ..." part of a find).   Can't quite seem to see how to make it work
> (e.g. passing an array in for the :joins parameter didn't seem to
> work).    If it is possible would you be able to drop in an example?
>
> (that is I'm talking about when you do a find, but make use of the
> ":joins => 'xxx'" option)
>
> thanks
>
> --
> Greghttp://blog.gregnet.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Fixed set of values for an attribute and migrations

2009-02-03 Thread jemminger

Check out validates_inclusion_of

http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002112



On Feb 3, 9:10 am, Juan Kinunt 
wrote:
> Hi,
> I have a model with three attributes that could be a fixed set of
> different values. Each attribute does not have sufficient entity to be a
> class (in my opinion) and I prefer to not to create classes in order to
> store them.
> For example, one attribute can be only three strings: phone, email or
> fax.
> The second, two strings: building or garage.
> The correct way of doing this is restricting to this values in the
> model?
> Is there something I can/have to do in the migration?
> I'm thinking about a validation of each field in the model and a
> selection-option field in the forms. Is this the best pattern in order
> to implement this? Would you prefer to create models for each of this
> attributes?
> Hope I explained myself properly.
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: .htaccess protection of public folder

2009-02-03 Thread jemminger

You're probably better off asking this in an Apache forum.


On Feb 3, 1:46 pm, Erwin  wrote:
> during staging devs, I want to protect the access to the site
>
> I wrote the folwoing into an .htaccess file in my public directory
>
> # Access control policy
> AuthType Basic
> AuthName "AelmatRepository"
> AuthUserFile /etc/apache2/dav_aelmat.passwd
> Require valid-user
>
> works fine... BUT  there is no access to the css  and images... !!!
>
> I belive I should add sometbing in my environment ? but what ?
>
> thanks for your help
>
> erwin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Redirecting root to mongrel prefix

2009-01-28 Thread jemminger


On Jan 28, 11:50 am, Freddy Andersen  wrote:
> I think you are missing a piece of the puzzle, Apache and
> mod_proxy...
>

Yes, this is running behind Apache.  We have a Java app that runs at
  http://java.ourdomain.com/foo

We have Apache proxy forwarding http://java.ourdomain.com/bar to
  http://rails.ourdomain.com/bar

...so that ajax calls aren't cross-domain to the java app.


The issue with redirecting the root requests to the prefixed URL is
more a matter of convenience, just so someone doesn't see "NOT FOUND"
if they happen to hit the root URL.

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



[Rails] Re: how to delete temp files

2009-01-28 Thread jemminger


http://www.ruby-doc.org/core-1.8.6/classes/FileUtils.html#M004365

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



[Rails] Re: javascript function needs rails variable

2009-01-28 Thread jemminger

This will only work if that script block is in an .erb template.

On Jan 28, 1:02 am, Rabia  wrote:
> 
>
>     document.getElementById('h').checked=true;
>     show_coords(<%= @pic_comments.to_json %>,"main",'<%=$domain%>/
> users/update_picture_div',<%= @picture.id %>)
>
>  
> I have implement this but rails variables are not working.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Best find for the job...

2009-01-28 Thread jemminger

In my opinion, the best way is the first way that works.  If that
method proves to be too inefficient, then optimize afterwards.


On Jan 28, 10:03 am, Neal L  wrote:
> Hi all,
>
> I'm trying to find the most effective way to generate an aggregation
> report.  The models involved are:
>
> Customer  --(has_many)--> Charges
> Charges --(have_one)-->Account
>
> What I'm trying to do is find the total charges during the year for
> each customer by account.  In other words, a function like:
>
> customer.charges_for_year()
>
> in the customer model that will return a hash of each account charged
> and the customer's total charges to that account.
>
> From what I've read I don't think I should be using named_scope, since
> this involves associations...
>
> Any ideas?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Redirecting root to mongrel prefix

2009-01-28 Thread jemminger

Mongrel can be started with a prefix e.g.

  mongrel_rails start -p 3000 --prefix /foobar

So that all of the app's URLs are prefixed, e.g.

  http://localhost:3000/foobar
  http://localhost:3000/foobar/posts
  http://localhost:3000/foobar/posts/1

The problem is that if you hit just the root ( http://localhost:3000/
) then mongrel responds with "NOT FOUND".

I tried adding an index.html to RAILS_ROOT/public that redirects to /
foobar, but this results in an infinite loop.

Does anyone know how to get requests to the root to redirect to the
prefix?

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



[Rails] Re: about private method test

2008-11-14 Thread jemminger



On Nov 14, 11:27 am, Robert Walker <[EMAIL PROTECTED]>
wrote:
> Jeff Emminger wrote:
> > it's up to you.  if you're satisfied that the private method is
> > working properly in the course of testing the public methods then
> > fine, otherwise you should be able to call the private method like:
>
> > @my_object.send(:private_method_name, arg1, arg2)
>
> I believe that I read somewhere that a future version of Ruby will be
> "fixed" to not allow using "send" to call private and protected methods.
> Which is really the behavior it should have had in the first place.
> Allowing this breaks the rules of encapsulation.
>
> A test case class is external to the class being tested, and like any
> other class SHOULD NOT have access to private data. Given that a private
> method should only ever be called from inside the confines of the class
> then you must access them via the public API and therefore tested though
> that public API.
>
> Test cases are clients of classes being tested in the same way any other
> class would be a client. This means that your tests, or specs, should
> test the behavior of the class through that same API. Theses tests
> should therefore be complete enough to exercise the "behavior" of the
> underlying private data and methods of the class being tested.
>
> At least this is my own understanding. Feel free to disagree...
> --

Yeah, that's probably the better route.  If you're resorting to
calling a protected or private method directly, then you either aren't
testing the public methods well enough or you haven't designed the
software well enough



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from 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: Batch invoice creator

2008-11-14 Thread jemminger

sounds ok to me... ultimately it's your app, you can do what you
want.  unless you plan on exposing a restful api to the world and
seeking Roy Fielding's blessing, who cares if it isn't purely
following the spec?


On Nov 14, 3:53 pm, Anthony <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm fairly new to Rails and I'm trying to wrap my head around the
> whole REST concept.  I'm creating an application that takes in sales
> data daily and at the end of the month it will create a batch of
> invoices in a Simply Accounting database.  I've already worked out the
> details on connecting to the external (Simply) db and creating the
> invoices.  What I don't really get is how to do this with a RESTful
> controller.
>
> My thought was to create a MonthEnd resource.  The 'new' action would
> basically ask for a month, then the 'create' action would actually
> build the invoices in the db.
>
> Does this sound ok, or is there a more elegant solution?
>
> 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: about private method test

2008-11-14 Thread jemminger

it's up to you.  if you're satisfied that the private method is
working properly in the course of testing the public methods then
fine, otherwise you should be able to call the private method like:

@my_object.send(:private_method_name, arg1, arg2)


On Nov 14, 10:16 am, daociyiyou <[EMAIL PROTECTED]> wrote:
> For the methods defined as private,we need to test it?
> For the reason that the private methods are used within the public
> methods,so we need not to test the private methods as long as the
> public methods are tested?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: could not find [gem] locally or in a repository

2008-11-14 Thread jemminger

Means whatever gem you're trying to install does not exist in your
current working dir or in the standard repositories.

You'll need to install via
  gem install some_gem http://some.server/path/to/some_gem

On Nov 14, 10:48 am, Remco Swoany <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> Every gem i tried to install i got the message:
>
> Error: Could not find  locally or in a repository!
>
> please some help...
>
> remco
> --
> 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: Argument error: Unknown key(s): count_includes

2008-11-14 Thread jemminger

"count_includes" is likely a method provided by AS.  I'd post this
error on their support forum.


On Nov 13, 7:34 pm, Caps Lock <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I upgraded to rails 2.1. This in turn broke my active_scaffolds plugin
> however, the AS team had a newer version that could handle 2.1
>
> So I install that, and now I find a new error which seems unrelated to
> the AS issue.
>
> I receive this message:
>
> Code :
>
>    1. ArgumentError in CategoryController#index
>    2.
>    3. Unknown key(s): count_includes
>
> What does this mean? Google will not tell me :-P.
>
> Anyways, here is the full trace file (which I do not understand)
>
> Code :
>
>    1.
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/hash/keys.rb:47:in
> `assert_valid_keys'
>    2. lib/finder.rb:80:in `find_page'
>    3. vendor/plugins/active_scaffold/lib/actions/list.rb:63:in `do_list'
>    4. vendor/plugins/active_scaffold/lib/actions/list.rb:33:in `list'
>    5. vendor/plugins/active_scaffold/lib/actions/list.rb:8:in `index'
>    6.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:1166:in
> `send'
>    7.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:1166:in
> `perform_action_without_filters'
>    8.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:579:in
> `call_filters'
>    9.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:572:in
> `perform_action_without_benchmark'
>   10.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/benchmarking.rb:68:in
> `perform_action_without_rescue'
>   11. /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>   12.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/benchmarking.rb:68:in
> `perform_action_without_rescue'
>   13.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/rescue.rb:201:in
> `perform_action_without_caching'
>   14.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_cache.rb:13:in
> `perform_action'
>   15.
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
> `cache'
>   16.
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/query_cache.rb:8:in
> `cache'
>   17.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_cache.rb:12:in
> `perform_action'
>   18.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in
> `send'
>   19.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in
> `process_without_filters'
>   20.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:568:in
> `process_without_session_management_support'
>   21.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/session_management.rb:130:in
> `process'
>   22.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:389:in
> `process'
>   23.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:149:in
> `handle_request'
>   24.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:107:in
> `dispatch'
>   25.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in
> `synchronize'
>   26.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in
> `dispatch'
>   27.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:120:in
> `dispatch_cgi'
>   28.
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:35:in
> `dispatch'
>
> Thank you for any help you can provide, and I am more than happy to give
> any additional information required.
> --
> 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: Cannot rake my gems

2008-11-14 Thread jemminger

try again with

  rake --trace rails:freeze:gems

to get a more descriptive error trace


On Nov 13, 7:33 pm, Caps Lock <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> So in a recently previous post I explained I am having an issue that I
> believe is due to the application being upgraded to 2.1 from 2.0.1
>
> To minimize headaches I thought freezing gems would be a grandios
> idea.
>
> however I recieve this error and I am finding little information on the
> web about it.
>
> Code :
>
>    1. [EMAIL PROTECTED]:/var/www/$ rake rails:freeze:gems
>    2. (in /var/www/gdc)
>    3. rake aborted!
>    4. undefined method `version' for nil:NilClass
>    5.
>    6. (See full trace by running task with --trace)
>    7. [EMAIL PROTECTED]:/var/www/$
>
> Does anyone know the issue?
>
> I read that it is possible my gems might be out of date or rake might
> be, so i try to update gems but I get a 'Killed' message with no sign of
> a successful update.
>
> Thank you for any knowledge you could provide.
> --
> 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: geting error while running functional test

2008-11-14 Thread jemminger

do you still have an app/controllers/application.rb?


On Nov 14, 4:31 am, Sunny Bogawat <[EMAIL PROTECTED]>
wrote:
> Hi in my application i had some fixtures.
>  and when i give command for running functional test i will get
> following error
>
> E:/projects/sprint_035/vendor/rails/activerecord/lib/../../activesupport/lib/act
> ive_support/dependencies.rb:266:in `load_missing_constant':
> uninitialized consta
> nt ApplicationController (NameError)
>         from
> E:/projects/sprint_035/vendor/rails/activerecord/lib/../../activesu
> pport/lib/active_support/dependencies.rb:452:in `const_missing'
>         from
> E:/projects/sprint_035/vendor/rails/activerecord/lib/../../activesu
> pport/lib/active_support/dependencies.rb:464:in `const_missing'
>         from
> E:/projects/sprint_035/app/controllers/members_controller.rb:3
>         from
> D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge
> m_original_require'
>
> please help me for resolve this  i am not understanding which gem/plugin
> is missing here.
> --
> 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: gems

2008-11-14 Thread jemminger

are you trying to update your installed gems?  do "sudo gem update"


On Nov 14, 6:37 am, "kode.poit" <[EMAIL PROTECTED]> wrote:
> After updating to rubygems 1.3 I started getting these warnings when
> running "rake gems:update" :
>
> WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
>           /usr/bin aren't both writable.
> WARNING:  You don't have /Users/myhome/.gem/ruby/1.8/bin in your PATH,
>           gem executables will not run.
>
> It looks like the gems unpack fine but I found this weird.
>
> Mac OS X 10.5.5
> gem 1.3.0
> edge rails
>
> Thanks.
> Mike
>
> +3
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from 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: Validating email

2008-11-14 Thread jemminger

Another contender... I use this one:

http://tfletcher.com/lib/rfc822.rb

usage:  validates_format_of :email, :with => RFC822::EmailAddress


On Nov 14, 8:50 am, Jodi Showers <[EMAIL PROTECTED]> wrote:
> Hey yo -
>
> On 13-Nov-08, at 11:14 PM, Craig Demyanovich wrote:
>
> > In my current project, I'm using the regexp 
> > fromhttp://www.regular-expressions.info/email.html
> >  with validates_format_of to validate email addresses.
>
> > Regards,
> > Craig
>
> Checked out this baby?
>
> http://ex-parrot.com/~pdw/Mail-RFC822-Address.html
>
> (I'm using something similar to Craig's - wonder if the above would  
> crack open a bug in ruby's regexp?
>
> 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: run migrations upon boot

2008-11-14 Thread jemminger

AFAIK the container expands the war to a directory... find that and cd
there

On Nov 14, 2:48 am, Clemens <[EMAIL PROTECTED]> wrote:
> On 13 Nov., 21:11, jemminger <[EMAIL PROTECTED]> wrote:> you could still 
> write a script that copies the war to the servlet
> > container, restarts it and runs "rake db:migrate RAILS_ENV=whatever"
>
> but all the rails sources are IN the war...? Where should I run rake?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from 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: Hiding URL params

2008-11-13 Thread jemminger

if your Post belongs_to a Group, then you can reference by
@post.group_id


On Nov 13, 3:30 pm, elioncho <[EMAIL PROTECTED]> wrote:
> Well, Long Version of the problem:
>
> I know that is impossible unless I have a session or maybe sending an
> extra param at the end of the url. The app I am creating is built
> around the concept of groups. So a user can belong to various groups
> and make posts and events on each of them. They also want the users
> profiles to stand-alone on the URL without the group preceding. So a
> user profile will show all his/her activity on all the groups. But
> then, If I am navigating through a group and click on a user who
> created and event I will be taken to he/she's profile and all the menu
> links for group events and posts will be broken because those links
> where created with the group_id. So now I there's no reference to
> which group I was navigating. That's why I asked if maybe I could have
> it there but hidden.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from 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: Touch an ActiveRecord - timestamps

2008-11-13 Thread jemminger

working for me in 2.1.2

# parent class
class Team < ActiveRecord::Base
  has_many :games
end

# child class
class Game < ActiveRecord::Base
  belongs_to :team
end

# unit test
require 'test_helper'
class GameTest < ActiveSupport::TestCase

  def test_updates_parent_timestamps
team = Team.create(:name => 'Team 1')
game = Game.create
team.games << game

team.save

assert team.valid?
assert game.valid?

old_date = team.updated_at
game.team.save

assert_not_equal old_date, team.reload.updated_at
  end

end



On Nov 13, 3:40 pm, David Warburton <[EMAIL PROTECTED]>
wrote:
> Jeff Emminger wrote:
> > just calling save on the parent association works in my testing, e.g.
> >   some_child.some_parent.save
>
> > On Nov 13, 10:08 am, David Warburton <[EMAIL PROTECTED]
>
> That was the first thing i tried :(.  I have rails 2.1.1.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Creating a file and saving in public directory

2008-11-13 Thread jemminger

try

  File.makedirs("#{RAILS_ROOT}/public/report")
  File.open("#{RAILS_ROOT}/public/report/waiting.adc", "w") { |
file|
file.write("hello world") }
end


On Nov 13, 4:26 pm, Ryan Mckenzie <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I'm fairly new to Ruby on Rails.
>
> I have a model called Report and I'm trying to create a text file that
> is saved in a /public/report directory.
>
> I've had a look at the ruby api but I can't seem to get this working.
>
> The current code I have is:
>
> #report.rb
> class Report < ActiveRecord::Base
>
>   after_save :write_file
>
>   def write_file
>     if @file_data
>       File.makedirs("#{RAILS_ROOT}/report")
>       File.open("#{RAILS_ROOT}/report/waiting.adc", "w") { |file|
> file.write("hello world") }
>     end
>   end
> end
>
> #report_controller.rb
>
> def new
>     @report = File.new
> end
>
> def create
>       if @report.save
>         flash[:notice]='report'
>       else
>         render :action=>'new'
>       end
> end
>
> Thank you for your time.
> --
> 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: IE's session id changes on every request

2008-11-13 Thread jemminger


On Nov 13, 3:22 pm, Clem Rock <[EMAIL PROTECTED]>
wrote:
> How would I isolate just the session_id or is there really such a
> session_id that doesn't change state w/ each action of a user session?
>
not sure... i've never had reason to use the session_id.  i just use
my properties as before, e.g. "session[:user_id]"

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



[Rails] Re: IE's session id changes on every request

2008-11-13 Thread jemminger

it's a bad idea to store actual objects in the session - just store an
ID if possible.


On Nov 13, 4:56 pm, Shandy Nantz <[EMAIL PROTECTED]>
wrote:
> Clem Rock wrote:
> > How would I isolate just the session_id or is there really such a
> > session_id that doesn't change state w/ each action of a user session?
>
> > Jeff Emminger wrote:
> >> Rails 2 uses cookie based sessions by default.  You're looking at
> >> everything you've stored in your session.
>
> >> On Nov 13, 2:48 pm, Clem Rock <[EMAIL PROTECTED]>
>
> Are you stroing an entire object in that session or just the id? I
> recently switched from rails 1.2.x to 2.0 and found that session data is
> handled differently between the two version. In rails 1.2.X. I could
> store an entire object but in 2.0 I can store only a limited amount of
> data in the session variable and one indication that you are storing an
> object is that large hash that you see in your example. I solved this
> problem by create several session variables that hold only id's - an id
> for a normal user, one for an administrator, etc.
>
> Hope this helps,
>
> -S
> --
> 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: IE's session id changes on every request

2008-11-13 Thread jemminger

Rails 2 uses cookie based sessions by default.  You're looking at
everything you've stored in your session.


On Nov 13, 2:48 pm, Clem Rock <[EMAIL PROTECTED]>
wrote:
> I have a very similar question.   I have an authentication module where
> I print out the session.session_id and it will look like this:
>
> BAh7CDoMY3NyZl9pZCIlZDAzYTUzMjEyNzgxYjY1NGVkNzRjOGUwYWMzMmIz
> N2QiDnJldHVybi10byIGLyIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6
> Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--02b20c5ea458a0a9f5a42e248d83f2438d29f720
>
> Then when I print out the same session.session_id in the next method
> called it bloats to this monstrosity:
>
> BAh7CjoSY2hhbGxlbmdlX2tleSIB90JBaDdDRG9NWTNOeVpsOXBaQ0lsWkRB
> ellUVXpNakV5TnpneFlqWTFOR1ZrTnpSak9HVXdZV016TW1JegpOMlFpRG5K
> bGRIVnliaTEwYnlJR0x5SUtabXhoYzJoSlF6b25RV04wYVc5dVEyOXVkSEp2
> Ykd4bGNqbzYKUm14aGMyZzZPa1pzWVhOb1NHRnphSHNBQmpvS1FIVnpaV1I3
> QUE9PS0tMDJiMjBjNWVhNDU4YTBhOWY1YTQyZTI0OGQ4M2YyNDM4ZDI5Zjcy
> MDgwNjI5NTM4MTg4MjcwN2U2NDQyYzM0NDgwYjExOThkYTVlMzNjNTNfNDA6
> CXVzZXJvOglVc2VyCDoQQGF0dHJpYnV0ZXN7FiIJc2FsdCIAIg91cGRhdGVk
> X2F0SXU6CVRpbWUNsykbgB1IV7cGOh9AbWFyc2hhbF93aXRoX3V0Y19jb2Vy
> Y2lvbkYiEWRlbGV0ZV9hZnRlcjAiE3NlY3VyaXR5X3Rva2VuIjA4MDYyOTUz
> ODE4ODI3MDdlNjQ0MmMzNDQ4MGIxMTk4ZGE1ZTMzYzUzXzQwIg11c2VybmFt
> ZSINYzczbXIwY2siB2lkIgYxIg5maXJzdG5hbWUwIg1sYXN0bmFtZTAiD3Vz
> ZXJfbGV2ZWwiBjEiEXRva2VuX2V4cGlyeTAiDGRlbGV0ZWQiBjAiDXZlcmlm
> aWVkIgYwIgpsb2dpbiIAIhRzYWx0ZWRfcGFzc3dvcmQiJTQxYTgxM2MwODNk
> ZGY2Y2ZiOTgwNjk4MzM0NGU3YWMwIhFsb2dnZWRfaW5fYXQwIgplbWFpbCIA
> Ig9jcmVhdGVkX2F0MDoYQGNoYW5nZWRfYXR0cmlidXRlc3sAOhZAYXR0cmli
> dXRlc19jYWNoZXsAIg5yZXR1cm4tdG8iBi86DGNzcmZfaWQiJWQwM2E1MzIx
> Mjc4MWI2NTRlZDc0YzhlMGFjMzJiMzdkIgpmbGFzaElDOidBY3Rpb25Db250
> cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--b8530fbb05eb97cfa9bc2f825be98190538c45ff
>
> Any ideas what's causing this?
>
>
>
> Sam Kong wrote:
> > Sam Kong wrote:
> >> Hi,
>
> >> I am developing a site with rails 2.1.2.
> >> restful_authentication is used.
>
> >> I can log in with Firefox but not with IE or Safari.
> >> I checked the log and found that session ID changes every time for IE.
>
> >> Why does this happen?
>
> >> Thanks.
>
> >> Sam
>
> > I found out the cause of the problem.
>
> > In my development server, the site was mapped to a host name that
> > includes an underscore(_).
> > It caused the problem.
>
> > I found it at
> >http://www.experts-exchange.com/Web_Development/Web_Languages-Standar
>
> > Thanks.
>
> > Sam
>
> --
> 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: run migrations upon boot

2008-11-13 Thread jemminger

you could still write a script that copies the war to the servlet
container, restarts it and runs "rake db:migrate RAILS_ENV=whatever"


On Nov 13, 12:18 pm, Clemens <[EMAIL PROTECTED]> wrote:
> On 13 Nov., 15:55, jemminger <[EMAIL PROTECTED]> wrote:
>
> > > Are there better/cleaner alternatives?
>
> > run at deploy time IMHO
>
> > using capistrano, "cap deploy:migrate"
>
> as mentioned above, deploying the app as a "war" into GlassFish, hence
> no capistrano...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >