Ruby on Rails Thursday, September 30, 2010

In my view, I do a

<%= render :partial => 'person', :collection =>
@household.people.sort_by(&:birthday) %>

household has a has_many relationship with person, and this works fine
until...

an errant user creates a new person and tries to save without filling
the fields(day, month, and year). After this the birthday field is
created and fails horribly. Is there any way to delete blank records
as part of the validation??


Thanks

Bob <bsm2th@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Radhames, you are suggesting one table called user? and bolean fields
for is_artist, is_member? Is that right?

On Oct 1, 5:19 am, radhames brito <rbri...@gmail.com> wrote:
> I would go with having a boolean field for artist and then conditional
> validarions, that is , if the field is true then have validations for artist
> apply along with the display of those extra field in the view, if the user
> stops been an artist, then it would stop validating and presenting those
> field, in fact would add a validation that would forbid those fields from
> changing while the artist value is false.

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Daniel Gaytán wrote:
> I have worked with mongrel. From what I remember, the temp files of
> mongrel
> are stored in RAILS_ROOT/tmp/pid or something like that.
>
> I used to delete them with one or some of the following rake tasks:
>
> rake tmp:cache:clear # Clears all files and
> directories
> in tmp/cache
> rake tmp:clear # Clear session, cache, and
> socket
> files from tmp/
> rake tmp:create # Creates tmp directories for
> sessions, cache, sockets, and pids
> rake tmp:pids:clear # Clears all files in tmp/pids
> rake tmp:sessions:clear # Clears all files in
> tmp/sessions
> rake tmp:sockets:clear # Clears all files in
> tmp/sockets
>
> Hope I have helped in a way.
>
> Daniel Gaytán
>
> 2010/9/30 Amit Tomar <lists@ruby-forum.com>

Thanks Daniel for your kind information..

But Daniel when i am trying to upload large files ,nothing is being
gethering in temp folder(RAILS_ROOT/tmp/pid) and i also checked other
folder inside and found nothing there .
In my case files are gethering in
TEMP(C:\DOCUME~1\x0138466\LOCALS~1\Temp) folder and to get rid off them
i have to restart server,but i don't want to restart my server.....
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Hi
I was asking about should I commit to svn the folder generated by

rake doc:app

ie doc/app folder completely
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

I found the problem. It seems Rails 3 is no longer configured for
auto-loading by default. To get the libraries and plugins loaded I
added the following lines to config/application.rb:

config.autoload_paths += %W(#{config.root}/lib)
config.plugin_paths = [File.join(RAILS_ROOT, 'vendor',
'other_plugins')]

More on this on the following pages:
https://rails.lighthouseapp.com/projects/8994/tickets/5218-rails-3-rc-does-not-autoload-from-lib
http://oreilly.com/ruby/excerpts/ruby-advanced-rails/rails-plugins.html

Regards,
Yaron

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have a job I want to run at midnight of whatever timezone the user
is in. Right now it runs at midnight, server time. I want to make it
run every hour and only affect the user's whose local time, at time of
running the task, is midnight.

The user database stores the user's timezone.

Is there a Ruby or Rails command that can check what timezone is at
midnight, then only run that job on the user's whose time is midnight?

Any other suggestions on how to run it....if anyone has done this
before...or has an idea...

Thanks guys
Sir Bertly.

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Greg, I have a working example that covers a bunch of gem features, it
might help you: http://keithschacht.com/creating-a-rails-3-engine-plugin-gem/


On Sep 29, 11:20 pm, Greg Willits <li...@ruby-forum.com> wrote:
> I'm accustomed to making plugins for Rails 2, and recently updated those
> for Rails 3 (minor differences in structure). Spent most of this week
> figuring out how to make most of those gems.
>
> One of them I am having trouble with -- this one involves an /app
> directory with some helpers and some views. It has worked great as a
> Rails2 and even Rails3 plugin. As a gem, I can't seem to get Rails to
> see the files in /app.
>
> I've been using jeweler. I don't use git, so I have been manually
> specifying files like this:
>
> Jeweler::Tasks.new do |gem|
>   #....
>   gem.files.include('app/**/*.rb')
>   gem.files.include('lib/**/*.rb')
>   #....
> end
>
> That's apparently not enough. The code in the gem works until the main
> app hits something needed from the gem's /app folder.
>
> I'm missing something. Googling and trial & error are failing me.
>
> What clue say ye? Thx.
>
> -- gw
> --
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Sep 30, 7:11 pm, Greg Donald <gdon...@gmail.com> wrote:
> Put the proper entry in your Gemfile, then run 'bundle install'.

I put "gem 'acts_as_list'" in Gemfile and ran "bundle install" but I'm
still getting the same error. And I don't necessarily need to run
acts_as_list as a gem do I? Also, this would not help with files in
the lib directory, which aren't loaded either.

Thanks,
Yaron

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Take a look at this


http://github.com/svenfuchs/globalize3

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Here is a cleaner way. Just put the following code on your
application_controller.rb.
Now, redirect_to should work with Ajax calls as well as regular
requests.

def redirect_to(options = {}, response_status = {})
if request.xhr?
render(:update) {|page| page.redirect_to(options)}
else
super(options, response_status)
end
end

Cheers,
Glen

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

We are looking for a team of 15 full-time RoR programmers to start
working on a secret project. We are only interested in shops which
have the following qualifications:

- Located within 2 hour plan ride from Saint Louis, MO
- Been in business for more then 3 years
- Completed large projects for fortune 1000 clients
- Have a Seasoned Team of 25+ who have worked together for 3+ years
- Have a solid project management platform and tool
- Can Architect and Implement a project from start to finish on-time
and on-budget
- Has Oracle Experience
- Has experience with Load Balancing Servers with fail-over
- Has experience with CDN's

Please email your portfolio and overview of your company to me for
evaluation.

This is a secret project so I cant share details for awhile but is
being backed by a top tier large tech company.

Thanks, Timothy Munro Roberts

Past Companies: Intira/Terremark, Savvis, GameStreamer, Phantom,
Qoncert Technologies, Phoenix Networks

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Put the proper entry in your Gemfile, then run 'bundle install'.

On Sep 30, 2010 5:43 PM, "RailsPeg" <largestscreen@googlemail.com> wrote:
> Hi.
>
> I'm running Rails 3.0 on Mac OS X, and I'm trying to get the
> acts_as_list, other plugins, as well as libraries running. From what
> I understand, rails should be loading those automatically once placed
> in the proper directories. However, that is not happening in my case,
> and I'm getting errors such as "undefined method `acts_as_list' for
> #<Class:0x1040dfde0>". acts_as_list is in vendor/plugins.
>
> Any insights would be greatly appreciated!
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi.

I'm running Rails 3.0 on Mac OS X, and I'm trying to get the
acts_as_list, other plugins, as well as libraries running. From what
I understand, rails should be loading those automatically once placed
in the proper directories. However, that is not happening in my case,
and I'm getting errors such as "undefined method `acts_as_list' for
#<Class:0x1040dfde0>". acts_as_list is in vendor/plugins.

Any insights would be greatly appreciated!

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

Ruby on Rails

Hi, I'm working on a project that has to be localized into 4 different
languages. I have no problem localizing the non-database-driven
strings, but there is some database content that also requires
localization. For instance, one of the fields is a list of different
types of injuries. Users of this database need the ability to add to
the list. A translator will work in parallel to convert the entries to
the other languages. The list of injuries will appear as
a :collection_select on forms in the app. The languages are Pashto,
Urdu, Arabic, and English.

What is the best way to approach localization of columns in the
database and have it serve the proper entries based on the language
parameter in the URL (or default to English)?

Thanks,
Clay

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Good point Luke, thank you.

I changed to admin_photographer_path as you suggested and it can pass
the redirection. Anyway something strange is still going on here:

1) it redirect to http://localhost:3000/admin/photographer/edit.1

there's still that .1 which smell of .:format mismatching ...

2) I've tons of that form_for(:name, @name, :url =>
resource_path, :html => { :multipart => true, :method => :put }) do |
f|

which are working just fine:

lsoave@ubuntu:~/rails/altrove/lauranovara$ find . -exec grep ":url =>
resource_path, :html => { :multipart => true, :method => :put })" {}
\; -print|grep ^./
./app/views/admin/photos/edit.html.haml
./app/views/admin/photographers/edit.html.haml
./app/views/admin/galleries/edit.html.haml
./app/views/admin/bookings/edit.html.haml
./app/views/admin/quotes/edit.html.haml
./app/views/admin/products/edit.html.haml
./app/views/admin/pages/edit.html.haml
./app/views/admin/gallery_photos/edit.html.haml
./log/development.log
lsoave@ubuntu:~/rails/altrove/lauranovara$

3) the old 2.3.8 used to work like that with same routing logic ...

Even if this make me able to going on, I'd really would like to figure
out what makes me .1 tail :-)
Until now, I've no idea about why my URL is generating
incorrectly ...

Many thanks to Luke and Frederick
for your precious suggestions
Luca G.Soave


On Sep 30, 7:42 pm, Luke Cowell <lcow...@gmail.com> wrote:
> Given the following:
>
> > = form_for(:photographer, @photographer, :url => resource_path, :html
> > => { :multipart => true, :method => :put }) do |f|
> > ...
>
> and
>
> > Rails 3.0.0 :
>
> >  namespace :admin do
> >    # session / login / logout
> >      resource :photographer_session
> >      match '/login' => 'photographer_sessions#new', :as => :login
> >      match '/logout' => 'photographer_sessions#destroy', :as
> > => :logout
> >      resource :photographer
> >      resources :photographer_password_resets
> >   end
>
> Should resource path be something else like admin_photographer_path ? I'm just guessing, but I'd also look at removing the :photographer and :method => :put from the form_for line. I think it's import to sort out why your URL is generating incorrectly before we troubleshoot the content type issue. For example, it might be thinking that .1 is a suffix just like .html or .css and is setting the resource type based on that.
>
> Also regarding checking the headers. I'll assume you're using or can use chrome. Look under the View menu -> Developer -> Developer tools. Click on the first item under resources (which should say 406) and click on the headers tab. Here you can find the accept and content type headers.
>
> Luke

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I would go with having a boolean field for artist and then conditional validarions, that is , if the field is true then have validations for artist apply along with the display of those extra field in the view, if the user stops been an artist, then it would stop validating and presenting those field, in fact would add a validation that would forbid those fields from changing while the artist value is false.

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have a developer who using Ruby on Rails to develop application for
our company. I'm work as Exchange admin. The developer will develop an
application (intranet) which will trigger email and relay via our
exchange 2007, so that staff able to receive email from intranet.
Currently we having problem with sending mail portion. The developer
usinf Action Mailer like below:

Address = smtp.domain.com
User_name = test@domain.com
Password = xxxx
domain = domain.com

Every time, this application try to relay email, it will show an
authentication error. The develope show the error to me. From exchange
side, I'm already trusted the application IP address to allow it relay
email.

May some body help on this, since I'm not famaliar with ruby.

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hey all,

Is anyone aware of a library to identify the use of track changes in
Microsoft Word documents?

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

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

Ruby on Rails

Newb Newb wrote:
> Actually I would like to know how to send the picture name in the xml
> response
>
> fox example picture = Picture.find(params[:id])
>
> Here i need to send the picture.id in the xml response...

I'm not sure what you're really asking, but maybe this will help:

Terminal
--------------
rails g scaffold picture name:string mime_type:string url:string
rake db:migrate
rails s (or ./script/server for Rails < 3.0)

THE CODE...

picture.rb
---------------
class Picture < ActiveRecord::Base
end

pictures_controller.rb
------------------
# GET /pictures/1
# GET /pictures/1.xml
def show
@picture = Picture.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @picture }
end
end

Terminal (again)
------------------------
$ curl http://localhost:3000/pictures/1.xml
<?xml version="1.0" encoding="UTF-8"?>
<picture>
<created-at type="datetime">2010-09-30T14:14:32Z</created-at>
<id type="integer">1</id>
<mime-type>image/jpeg</mime-type>
<name>Fox Example Picture</name>
<updated-at type="datetime">2010-09-30T14:14:32Z</updated-at>
<url>http://images.nationalgeographic.com/wpf/media-live/photos/000/006/cache/red-fox_679_600x450.jpg</url>
</picture>
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Well its the primary nature of the site. So expect to have tons of
media types. Initially, I thought separating them would keep the
tables smaller since each media type has its own table.

Someone mentioned that having it as an STI is fine. Like any other app
that becomes huge, we can always optimize?

On Sep 30, 8:29 pm, Michael Pavling <pavl...@gmail.com> wrote:
> On 30 September 2010 13:17, Christian Fazzini
>
> <christian.fazz...@gmail.com> wrote:
> > Ive got 3 types of media. Event, photo and video.
>
> > Most of these share common columns (title, description, etc). I am
> > thinking of creating a 4th model called media. And then event, photo
> > and video will inherit from media, making media an STI.
>
> > Is this a good approach?
>
> It is an option - for me, it would depend on how much other, different
> data each model has.
> Your structure may also suit a polymorphic approach - so that Event,
> Photo, and Video all have a "Media" association for the common fields.
>
> > I am worried that since all submissions are going into one table (the
> > media table). Some db performance issues may arise?
>
> How many Media do you plan to have?... what sort of problems do you
> anticipate that you wouldn't have with separate tables?

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Tom Mac wrote:
> Hi
> I would like to know expert opinion on this. Should I commit folders
> like doc/app into svn? What is the general strategy

Nothing should ever be committed to svn... http://git-scm.com/ :-)

However, yes I most definitely version control my application
documentation.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

... yes, first thing I did before my very first post,
anyway, can't understand what's wrong with it :

Rails 2.3.8 :

map.namespace :admin do |admin|
# session / login / logout
admin.resource :photographer_session
admin.login '/login', :controller =>
"photographer_sessions", :action => "new"
admin.logout '/logout', :controller =>
"photographer_sessions", :action => "destroy"
admin.resource :photographer
admin.resources :photographer_password_resets
...

Rails 3.0.0 :

namespace :admin do
# session / login / logout
resource :photographer_session
match '/login' => 'photographer_sessions#new', :as => :login
match '/logout' => 'photographer_sessions#destroy', :as
=> :logout
resource :photographer
resources :photographer_password_resets
...

everything seems ok with the new sintax ..., well I think so, anyway
here what "rake routes" show up for admin photographer in both Rails
2.3.8 http://pastie.org/1191253 and Rails 3.0.0 http://pastie.org/1191246

On Sep 30, 2:51 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Sep 30, 1:49 pm, lgs <luca.so...@gmail.com> wrote:> No it's wrong, it is a POST tohttp://localhost:3000/admin/photographer.1
> > and tha page doesn't show up, it's blank.
>
> I'd start by finding out why the url generated ends in .1. Something
> funny in your routes maybe?
>
> Fred
>
> > In case of Rails 2.3.8 I get - Processing
> > Admin::PhotographersController#update (for 127.0.0.1 at 2010-09-29
> > 19:19:38) [PUT] - instead of POST and than redirect back tohttp://localhost:3000/admin/photographer/edit
>
> > Here a vision of the failure, Firebug side:
>
> > POST photographer.1http://localhost:3000/admin/photographer.1406Not
> > Acceptable localhost:3000 1 B
>
> > Response Headersview source
> > x-ua-compatible IE=Edge
> > Connection      Keep-Alive
> > Content-Type    text/html; charset=utf-8
> > Date    Thu, 30 Sep 2010 12:09:14 GMT
> > Server  WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16)
> > X-Runtime       0.849066
> > Content-Length  1
> > Cache-Control   no-cache
> > Set-Cookie      _lauranovara_session=xxxxx .....;
> > path=/; HttpOnly
>
> > Request Headersview source
> > Host    localhost:3000
> > User-Agent      Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/
> > 20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10
> > Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > Accept-Language en-us,en;q=0.5
> > Accept-Encoding gzip,deflate
> > Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive      115
> > Connection      keep-alive
> > Refererhttp://localhost:3000/admin/photographer/edit
> > Cookie  txtMainTab=Timeline; _lauranovara.com_session=xxxxxxxx
> > ....
>
> > On Sep 30, 2:27 pm, Frederick Cheung <frederick.che...@gmail.com>
> > wrote:
>
> > > On Sep 30, 12:30 pm, lgs <luca.so...@gmail.com> wrote:> I'm not sure to have the competence to fully understand your &
> > > > Frederick question,
> > > > so please, could you tell me how/where can I check that ?
>
> > > I'd check what the url the form posts to is - does it look right? (ie
> > > view the html produced by the edit form)
>
> > > Fred
>
> > > > Thanks in advance
> > > > Luca
>
> > > > On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
>
> > > > > I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> > > > > I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> > > > > Luke
>
> > > > > On 2010-09-29, at 12:01 PM, lgs wrote:
>
> > > > > > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > > > > > [paperclip] Saving attachments.
> > > > > > SQL (49.3ms)   COMMIT
> > > > > > Redirected tohttp://localhost:3000/admin/photographer/edit
> > > > > > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > > > > > photographer]
>
> > > > > > after migrating to Rails 3.0.0 I get this:
>
> > > > > > [paperclip] Saving attachments.
> > > > > > SQL (595.4ms)  COMMIT
> > > > > > Completed 406 Not Acceptable in 812ms
>
> > > > > > so I guess the failing code in my controller
> > > > > > Admin::PhotographersController#update  is
>
> > > > > >      redirect_to edit_resource_path
>
> > > > > > ... any suggestion ?
> > > > > > How can I procede troubleshooting ?
>
> > > > > > Thanks in advance
> > > > > > Luca
>
> > > > > > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> > > > > >> It's goes through Admin::PhotographersController#edit action, opening
> > > > > >> a form which I have to fill:
>
> > > > > >>   def edit
> > > > > >>     @photographer = current_photographer
> > > > > >>   end
>
> > > > > >> then it goes to Admin::PhotographersController#update :
>
> > > > > >>   def update
> > > > > >>     @photographer = current_photographer
> > > > > >>     if params[:id]
> > > > > >>       # trying to update a specific photographer on a singular
> > > > > >> resource is a no-no
> > > > > >>       flash[:notice] = "You can only update your own settings!"
> > > > > >>       redirect_to edit_resource_path
> > > > > >>     else
> > > > > >>       update!{ edit_resource_path }
> > > > > >>     end
> > > > > >>   end
>
> > > > > >> here is the controllerhttp://pastie.org/1189038
> > > > > >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> > > > > >> snap )
>
> > > > > >> = form_for(:photographer, @photographer, :url => resource_path, :html
> > > > > >> => { :multipart => true, :method => :put }) do |f|
> > > > > >> ...
> > > > > >> ...
> > > > > >>     %p
> > > > > >>       = f.label :theme
> > > > > >>       = f.select :theme, Photographer.themes
> > > > > >>     %p
> > > > > >>       = f.label :use_watermark, "Automatically watermark your client
> > > > > >> photos?"
> > > > > >>       = f.check_box :use_watermark
> > > > > >> ...
>
> > > > > >> Luca
>
> > > > > >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> > > > > >> wrote:
>
> > > > > >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> > > > > >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> > > > > >>>>       Completed 406 Not Acceptable in 513ms
>
> > > > > >>>> I also noted that processing controller doesn't output the protocol:
>
> > > > > >>>> -- Processing by Admin::PhotographersController#update as
>
> > > > > >>>> while if it works, say:
>
> > > > > >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> > > > > >>>> Here is the full action outputhttp://pastie.org/1187051
>
> > > > > >>>> Can anyone help me, please ?
> > > > > >>>> Don't know where to start :-(
>
> > > > > >>> At a guess it's because the url being posted to is /admin/photographer.
> > > > > >>> 1 which may be making part of rails think that the requested format
> > > > > >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> > > > > >>> block rails can't generate a response and so generates a 406 instead
> > > > > >>> (which is http for "I can't generate the kind of response you asked
> > > > > >>> for")
>
> > > > > >>> Fred
>
> > > > > >>>> Luca
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > > > > > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

... yes, first thing I did before my very first post,
anyway, can't understand what's wrong with it :

Rails 2.3.8 :

map.namespace :admin do |admin|
# session / login / logout
admin.resource :photographer_session
admin.login '/login', :controller =>
"photographer_sessions", :action => "new"
admin.logout '/logout', :controller =>
"photographer_sessions", :action => "destroy"
admin.resource :photographer
admin.resources :photographer_password_resets
...

Rails 3.0.0 :

namespace :admin do
# session / login / logout
resource :photographer_session
match '/login' => 'photographer_sessions#new', :as => :login
match '/logout' => 'photographer_sessions#destroy', :as
=> :logout
resource :photographer
resources :photographer_password_resets
...

everything seems ok with the new sintax ..., well I think so, anyway
here what "rake routes" show up for admin photographer in both Rails
2.3.8 http://pastie.org/1191253 and Rails 3.0.0 http://pastie.org/1191246

On Sep 30, 2:51 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Sep 30, 1:49 pm, lgs <luca.so...@gmail.com> wrote:> No it's wrong, it is a POST tohttp://localhost:3000/admin/photographer.1
> > and tha page doesn't show up, it's blank.
>
> I'd start by finding out why the url generated ends in .1. Something
> funny in your routes maybe?
>
> Fred
>
> > In case of Rails 2.3.8 I get - Processing
> > Admin::PhotographersController#update (for 127.0.0.1 at 2010-09-29
> > 19:19:38) [PUT] - instead of POST and than redirect back tohttp://localhost:3000/admin/photographer/edit
>
> > Here a vision of the failure, Firebug side:
>
> > POST photographer.1http://localhost:3000/admin/photographer.1406Not
> > Acceptable localhost:3000 1 B
>
> > Response Headersview source
> > x-ua-compatible IE=Edge
> > Connection      Keep-Alive
> > Content-Type    text/html; charset=utf-8
> > Date    Thu, 30 Sep 2010 12:09:14 GMT
> > Server  WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16)
> > X-Runtime       0.849066
> > Content-Length  1
> > Cache-Control   no-cache
> > Set-Cookie      _lauranovara_session=xxxxx .....;
> > path=/; HttpOnly
>
> > Request Headersview source
> > Host    localhost:3000
> > User-Agent      Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/
> > 20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10
> > Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > Accept-Language en-us,en;q=0.5
> > Accept-Encoding gzip,deflate
> > Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive      115
> > Connection      keep-alive
> > Refererhttp://localhost:3000/admin/photographer/edit
> > Cookie  txtMainTab=Timeline; _lauranovara.com_session=xxxxxxxx
> > ....
>
> > On Sep 30, 2:27 pm, Frederick Cheung <frederick.che...@gmail.com>
> > wrote:
>
> > > On Sep 30, 12:30 pm, lgs <luca.so...@gmail.com> wrote:> I'm not sure to have the competence to fully understand your &
> > > > Frederick question,
> > > > so please, could you tell me how/where can I check that ?
>
> > > I'd check what the url the form posts to is - does it look right? (ie
> > > view the html produced by the edit form)
>
> > > Fred
>
> > > > Thanks in advance
> > > > Luca
>
> > > > On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
>
> > > > > I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> > > > > I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> > > > > Luke
>
> > > > > On 2010-09-29, at 12:01 PM, lgs wrote:
>
> > > > > > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > > > > > [paperclip] Saving attachments.
> > > > > > SQL (49.3ms)   COMMIT
> > > > > > Redirected tohttp://localhost:3000/admin/photographer/edit
> > > > > > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > > > > > photographer]
>
> > > > > > after migrating to Rails 3.0.0 I get this:
>
> > > > > > [paperclip] Saving attachments.
> > > > > > SQL (595.4ms)  COMMIT
> > > > > > Completed 406 Not Acceptable in 812ms
>
> > > > > > so I guess the failing code in my controller
> > > > > > Admin::PhotographersController#update  is
>
> > > > > >      redirect_to edit_resource_path
>
> > > > > > ... any suggestion ?
> > > > > > How can I procede troubleshooting ?
>
> > > > > > Thanks in advance
> > > > > > Luca
>
> > > > > > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> > > > > >> It's goes through Admin::PhotographersController#edit action, opening
> > > > > >> a form which I have to fill:
>
> > > > > >>   def edit
> > > > > >>     @photographer = current_photographer
> > > > > >>   end
>
> > > > > >> then it goes to Admin::PhotographersController#update :
>
> > > > > >>   def update
> > > > > >>     @photographer = current_photographer
> > > > > >>     if params[:id]
> > > > > >>       # trying to update a specific photographer on a singular
> > > > > >> resource is a no-no
> > > > > >>       flash[:notice] = "You can only update your own settings!"
> > > > > >>       redirect_to edit_resource_path
> > > > > >>     else
> > > > > >>       update!{ edit_resource_path }
> > > > > >>     end
> > > > > >>   end
>
> > > > > >> here is the controllerhttp://pastie.org/1189038
> > > > > >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> > > > > >> snap )
>
> > > > > >> = form_for(:photographer, @photographer, :url => resource_path, :html
> > > > > >> => { :multipart => true, :method => :put }) do |f|
> > > > > >> ...
> > > > > >> ...
> > > > > >>     %p
> > > > > >>       = f.label :theme
> > > > > >>       = f.select :theme, Photographer.themes
> > > > > >>     %p
> > > > > >>       = f.label :use_watermark, "Automatically watermark your client
> > > > > >> photos?"
> > > > > >>       = f.check_box :use_watermark
> > > > > >> ...
>
> > > > > >> Luca
>
> > > > > >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> > > > > >> wrote:
>
> > > > > >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> > > > > >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> > > > > >>>>       Completed 406 Not Acceptable in 513ms
>
> > > > > >>>> I also noted that processing controller doesn't output the protocol:
>
> > > > > >>>> -- Processing by Admin::PhotographersController#update as
>
> > > > > >>>> while if it works, say:
>
> > > > > >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> > > > > >>>> Here is the full action outputhttp://pastie.org/1187051
>
> > > > > >>>> Can anyone help me, please ?
> > > > > >>>> Don't know where to start :-(
>
> > > > > >>> At a guess it's because the url being posted to is /admin/photographer.
> > > > > >>> 1 which may be making part of rails think that the requested format
> > > > > >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> > > > > >>> block rails can't generate a response and so generates a 406 instead
> > > > > >>> (which is http for "I can't generate the kind of response you asked
> > > > > >>> for")
>
> > > > > >>> Fred
>
> > > > > >>>> Luca
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > > > > > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Sep 30, 1:49 pm, lgs <luca.so...@gmail.com> wrote:
> No it's wrong, it is a POST tohttp://localhost:3000/admin/photographer.1
> and tha page doesn't show up, it's blank.
>
I'd start by finding out why the url generated ends in .1. Something
funny in your routes maybe?

Fred
> In case of Rails 2.3.8 I get - Processing
> Admin::PhotographersController#update (for 127.0.0.1 at 2010-09-29
> 19:19:38) [PUT] - instead of POST and than redirect back tohttp://localhost:3000/admin/photographer/edit
>
> Here a vision of the failure, Firebug side:
>
> POST photographer.1http://localhost:3000/admin/photographer.1406 Not
> Acceptable localhost:3000 1 B
>
> Response Headersview source
> x-ua-compatible IE=Edge
> Connection      Keep-Alive
> Content-Type    text/html; charset=utf-8
> Date    Thu, 30 Sep 2010 12:09:14 GMT
> Server  WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16)
> X-Runtime       0.849066
> Content-Length  1
> Cache-Control   no-cache
> Set-Cookie      _lauranovara_session=xxxxx .....;
> path=/; HttpOnly
>
> Request Headersview source
> Host    localhost:3000
> User-Agent      Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/
> 20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10
> Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language en-us,en;q=0.5
> Accept-Encoding gzip,deflate
> Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive      115
> Connection      keep-alive
> Refererhttp://localhost:3000/admin/photographer/edit
> Cookie  txtMainTab=Timeline; _lauranovara.com_session=xxxxxxxx
> ....
>
> On Sep 30, 2:27 pm, Frederick Cheung <frederick.che...@gmail.com>
> wrote:
>
>
>
> > On Sep 30, 12:30 pm, lgs <luca.so...@gmail.com> wrote:> I'm not sure to have the competence to fully understand your &
> > > Frederick question,
> > > so please, could you tell me how/where can I check that ?
>
> > I'd check what the url the form posts to is - does it look right? (ie
> > view the html produced by the edit form)
>
> > Fred
>
> > > Thanks in advance
> > > Luca
>
> > > On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
>
> > > > I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> > > > I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> > > > Luke
>
> > > > On 2010-09-29, at 12:01 PM, lgs wrote:
>
> > > > > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > > > > [paperclip] Saving attachments.
> > > > > SQL (49.3ms)   COMMIT
> > > > > Redirected tohttp://localhost:3000/admin/photographer/edit
> > > > > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > > > > photographer]
>
> > > > > after migrating to Rails 3.0.0 I get this:
>
> > > > > [paperclip] Saving attachments.
> > > > > SQL (595.4ms)  COMMIT
> > > > > Completed 406 Not Acceptable in 812ms
>
> > > > > so I guess the failing code in my controller
> > > > > Admin::PhotographersController#update  is
>
> > > > >      redirect_to edit_resource_path
>
> > > > > ... any suggestion ?
> > > > > How can I procede troubleshooting ?
>
> > > > > Thanks in advance
> > > > > Luca
>
> > > > > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> > > > >> It's goes through Admin::PhotographersController#edit action, opening
> > > > >> a form which I have to fill:
>
> > > > >>   def edit
> > > > >>     @photographer = current_photographer
> > > > >>   end
>
> > > > >> then it goes to Admin::PhotographersController#update :
>
> > > > >>   def update
> > > > >>     @photographer = current_photographer
> > > > >>     if params[:id]
> > > > >>       # trying to update a specific photographer on a singular
> > > > >> resource is a no-no
> > > > >>       flash[:notice] = "You can only update your own settings!"
> > > > >>       redirect_to edit_resource_path
> > > > >>     else
> > > > >>       update!{ edit_resource_path }
> > > > >>     end
> > > > >>   end
>
> > > > >> here is the controllerhttp://pastie.org/1189038
> > > > >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> > > > >> snap )
>
> > > > >> = form_for(:photographer, @photographer, :url => resource_path, :html
> > > > >> => { :multipart => true, :method => :put }) do |f|
> > > > >> ...
> > > > >> ...
> > > > >>     %p
> > > > >>       = f.label :theme
> > > > >>       = f.select :theme, Photographer.themes
> > > > >>     %p
> > > > >>       = f.label :use_watermark, "Automatically watermark your client
> > > > >> photos?"
> > > > >>       = f.check_box :use_watermark
> > > > >> ...
>
> > > > >> Luca
>
> > > > >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> > > > >> wrote:
>
> > > > >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> > > > >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> > > > >>>>       Completed 406 Not Acceptable in 513ms
>
> > > > >>>> I also noted that processing controller doesn't output the protocol:
>
> > > > >>>> -- Processing by Admin::PhotographersController#update as
>
> > > > >>>> while if it works, say:
>
> > > > >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> > > > >>>> Here is the full action outputhttp://pastie.org/1187051
>
> > > > >>>> Can anyone help me, please ?
> > > > >>>> Don't know where to start :-(
>
> > > > >>> At a guess it's because the url being posted to is /admin/photographer.
> > > > >>> 1 which may be making part of rails think that the requested format
> > > > >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> > > > >>> block rails can't generate a response and so generates a 406 instead
> > > > >>> (which is http for "I can't generate the kind of response you asked
> > > > >>> for")
>
> > > > >>> Fred
>
> > > > >>>> Luca
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > > > > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

No it's wrong, it is a POST to http://localhost:3000/admin/photographer.1
and tha page doesn't show up, it's blank.

In case of Rails 2.3.8 I get - Processing
Admin::PhotographersController#update (for 127.0.0.1 at 2010-09-29
19:19:38) [PUT] - instead of POST and than redirect back to
http://localhost:3000/admin/photographer/edit


Here a vision of the failure, Firebug side:

POST photographer.1 http://localhost:3000/admin/photographer.1 406 Not
Acceptable localhost:3000 1 B

Response Headersview source
x-ua-compatible IE=Edge
Connection Keep-Alive
Content-Type text/html; charset=utf-8
Date Thu, 30 Sep 2010 12:09:14 GMT
Server WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16)
X-Runtime 0.849066
Content-Length 1
Cache-Control no-cache
Set-Cookie _lauranovara_session=xxxxx .....;
path=/; HttpOnly

Request Headersview source
Host localhost:3000
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/
20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Referer http://localhost:3000/admin/photographer/edit
Cookie txtMainTab=Timeline; _lauranovara.com_session=xxxxxxxx
....


On Sep 30, 2:27 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Sep 30, 12:30 pm, lgs <luca.so...@gmail.com> wrote:> I'm not sure to have the competence to fully understand your &
> > Frederick question,
> > so please, could you tell me how/where can I check that ?
>
> I'd check what the url the form posts to is - does it look right? (ie
> view the html produced by the edit form)
>
> Fred
>
> > Thanks in advance
> > Luca
>
> > On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
>
> > > I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> > > I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> > > Luke
>
> > > On 2010-09-29, at 12:01 PM, lgs wrote:
>
> > > > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > > > [paperclip] Saving attachments.
> > > > SQL (49.3ms)   COMMIT
> > > > Redirected tohttp://localhost:3000/admin/photographer/edit
> > > > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > > > photographer]
>
> > > > after migrating to Rails 3.0.0 I get this:
>
> > > > [paperclip] Saving attachments.
> > > > SQL (595.4ms)  COMMIT
> > > > Completed 406 Not Acceptable in 812ms
>
> > > > so I guess the failing code in my controller
> > > > Admin::PhotographersController#update  is
>
> > > >      redirect_to edit_resource_path
>
> > > > ... any suggestion ?
> > > > How can I procede troubleshooting ?
>
> > > > Thanks in advance
> > > > Luca
>
> > > > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> > > >> It's goes through Admin::PhotographersController#edit action, opening
> > > >> a form which I have to fill:
>
> > > >>   def edit
> > > >>     @photographer = current_photographer
> > > >>   end
>
> > > >> then it goes to Admin::PhotographersController#update :
>
> > > >>   def update
> > > >>     @photographer = current_photographer
> > > >>     if params[:id]
> > > >>       # trying to update a specific photographer on a singular
> > > >> resource is a no-no
> > > >>       flash[:notice] = "You can only update your own settings!"
> > > >>       redirect_to edit_resource_path
> > > >>     else
> > > >>       update!{ edit_resource_path }
> > > >>     end
> > > >>   end
>
> > > >> here is the controllerhttp://pastie.org/1189038
> > > >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> > > >> snap )
>
> > > >> = form_for(:photographer, @photographer, :url => resource_path, :html
> > > >> => { :multipart => true, :method => :put }) do |f|
> > > >> ...
> > > >> ...
> > > >>     %p
> > > >>       = f.label :theme
> > > >>       = f.select :theme, Photographer.themes
> > > >>     %p
> > > >>       = f.label :use_watermark, "Automatically watermark your client
> > > >> photos?"
> > > >>       = f.check_box :use_watermark
> > > >> ...
>
> > > >> Luca
>
> > > >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> > > >> wrote:
>
> > > >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> > > >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> > > >>>>       Completed 406 Not Acceptable in 513ms
>
> > > >>>> I also noted that processing controller doesn't output the protocol:
>
> > > >>>> -- Processing by Admin::PhotographersController#update as
>
> > > >>>> while if it works, say:
>
> > > >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> > > >>>> Here is the full action outputhttp://pastie.org/1187051
>
> > > >>>> Can anyone help me, please ?
> > > >>>> Don't know where to start :-(
>
> > > >>> At a guess it's because the url being posted to is /admin/photographer.
> > > >>> 1 which may be making part of rails think that the requested format
> > > >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> > > >>> block rails can't generate a response and so generates a 406 instead
> > > >>> (which is http for "I can't generate the kind of response you asked
> > > >>> for")
>
> > > >>> Fred
>
> > > >>>> Luca
>
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > > > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 30 September 2010 13:17, Christian Fazzini
<christian.fazzini@gmail.com> wrote:
> Ive got 3 types of media. Event, photo and video.
>
> Most of these share common columns (title, description, etc). I am
> thinking of creating a 4th model called media. And then event, photo
> and video will inherit from media, making media an STI.
>
> Is this a good approach?

It is an option - for me, it would depend on how much other, different
data each model has.
Your structure may also suit a polymorphic approach - so that Event,
Photo, and Video all have a "Media" association for the common fields.

> I am worried that since all submissions are going into one table (the
> media table). Some db performance issues may arise?

How many Media do you plan to have?... what sort of problems do you
anticipate that you wouldn't have with separate tables?

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Sep 30, 12:30 pm, lgs <luca.so...@gmail.com> wrote:
> I'm not sure to have the competence to fully understand your &
> Frederick question,
> so please, could you tell me how/where can I check that ?
>
I'd check what the url the form posts to is - does it look right? (ie
view the html produced by the edit form)

Fred
> Thanks in advance
> Luca
>
> On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
>
>
>
> > I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> > I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> > Luke
>
> > On 2010-09-29, at 12:01 PM, lgs wrote:
>
> > > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > > [paperclip] Saving attachments.
> > > SQL (49.3ms)   COMMIT
> > > Redirected tohttp://localhost:3000/admin/photographer/edit
> > > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > > photographer]
>
> > > after migrating to Rails 3.0.0 I get this:
>
> > > [paperclip] Saving attachments.
> > > SQL (595.4ms)  COMMIT
> > > Completed 406 Not Acceptable in 812ms
>
> > > so I guess the failing code in my controller
> > > Admin::PhotographersController#update  is
>
> > >      redirect_to edit_resource_path
>
> > > ... any suggestion ?
> > > How can I procede troubleshooting ?
>
> > > Thanks in advance
> > > Luca
>
> > > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> > >> It's goes through Admin::PhotographersController#edit action, opening
> > >> a form which I have to fill:
>
> > >>   def edit
> > >>     @photographer = current_photographer
> > >>   end
>
> > >> then it goes to Admin::PhotographersController#update :
>
> > >>   def update
> > >>     @photographer = current_photographer
> > >>     if params[:id]
> > >>       # trying to update a specific photographer on a singular
> > >> resource is a no-no
> > >>       flash[:notice] = "You can only update your own settings!"
> > >>       redirect_to edit_resource_path
> > >>     else
> > >>       update!{ edit_resource_path }
> > >>     end
> > >>   end
>
> > >> here is the controllerhttp://pastie.org/1189038
> > >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> > >> snap )
>
> > >> = form_for(:photographer, @photographer, :url => resource_path, :html
> > >> => { :multipart => true, :method => :put }) do |f|
> > >> ...
> > >> ...
> > >>     %p
> > >>       = f.label :theme
> > >>       = f.select :theme, Photographer.themes
> > >>     %p
> > >>       = f.label :use_watermark, "Automatically watermark your client
> > >> photos?"
> > >>       = f.check_box :use_watermark
> > >> ...
>
> > >> Luca
>
> > >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> > >> wrote:
>
> > >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> > >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> > >>>>       Completed 406 Not Acceptable in 513ms
>
> > >>>> I also noted that processing controller doesn't output the protocol:
>
> > >>>> -- Processing by Admin::PhotographersController#update as
>
> > >>>> while if it works, say:
>
> > >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> > >>>> Here is the full action outputhttp://pastie.org/1187051
>
> > >>>> Can anyone help me, please ?
> > >>>> Don't know where to start :-(
>
> > >>> At a guess it's because the url being posted to is /admin/photographer.
> > >>> 1 which may be making part of rails think that the requested format
> > >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> > >>> block rails can't generate a response and so generates a 406 instead
> > >>> (which is http for "I can't generate the kind of response you asked
> > >>> for")
>
> > >>> Fred
>
> > >>>> Luca
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

The stale & fresh blocks already will send not modified back to the client. Since you are also sending it, you get a double render.


On Sep 18, 2010, at 10:18 PM, badnaam wrote:

>
> ##updated
>
> def index
> case params[:listing_type]
> when "all"
> #the key here is teh same key I used for
> memcached
> if stale?(:etag => 'all_posts_key')
> @posts = get_all_post_from_memcached
> else
> head :not_modified and return
> end
> when "most_popular"
> if stale?(:etag => 'most_popular_key')
> @posts = get_all_most_popular_from_memcached
> else
> head :notified and return
> end
> respond_to do |format|
> format.html
> format.js #for ajax reqeusts
> format.xml #for rss etc
> end
>
>
> update. I changed the original block a little and now get a double
> render error what am I doing wrong, should "head :notified and return"
> just return the header and not touch the respond_to block?
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Ive got 3 types of media. Event, photo and video.

Most of these share common columns (title, description, etc). I am
thinking of creating a 4th model called media. And then event, photo
and video will inherit from media, making media an STI.

Is this a good approach?
I am worried that since all submissions are going into one table (the
media table). Some db performance issues may arise?

What are your thoughts?

--
You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Robert Walker wrote:
> An alternative, or more likely in combination with cucumber stories,
> RSSpec provides routing expectations:
>
> Examples:
> route_for(:controller => "hello", :action => "world").should ==
> "/hello/world"
> params_from(:get, "/hello/world").should == {:controller => "hello",
> :action => "world"}
>
> So one could list all routes with "rake routes" and then write RSpec
> examples to test them.

Alright, thank you. But there's no way to let it test all routes
automatically extracted from "rake routes"?
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

I'm not sure to have the competence to fully understand your &
Frederick question,
so please, could you tell me how/where can I check that ?

Thanks in advance
Luca

On Sep 30, 4:40 am, Luke Cowell <lcow...@gmail.com> wrote:
> I agree with Fred. What does your 'Accept' header in your browser say for the request that throws the 406? eg. Accept:text/css Also, check the content-type in the response headers. You could grab this information using the developer console in safari or chrome, or firebug in firefox.
>
> I saw something very similar which affect Firefox, but not Safari or Chrome.
>
> Luke
>
> On 2010-09-29, at 12:01 PM, lgs wrote:
>
>
>
> > ... ok, this is the piece of log which works ( Rails 2.3.8 )
>
> > [paperclip] Saving attachments.
> > SQL (49.3ms)   COMMIT
> > Redirected tohttp://localhost:3000/admin/photographer/edit
> > Completed in 223ms (DB: 0) | 302 Found [http://localhost/admin/
> > photographer]
>
> > after migrating to Rails 3.0.0 I get this:
>
> > [paperclip] Saving attachments.
> > SQL (595.4ms)  COMMIT
> > Completed 406 Not Acceptable in 812ms
>
> > so I guess the failing code in my controller
> > Admin::PhotographersController#update  is
>
> >      redirect_to edit_resource_path
>
> > ... any suggestion ?
> > How can I procede troubleshooting ?
>
> > Thanks in advance
> > Luca
>
> > On Sep 29, 4:53 pm, lgs <luca.so...@gmail.com> wrote:
> >> It's goes through Admin::PhotographersController#edit action, opening
> >> a form which I have to fill:
>
> >>   def edit
> >>     @photographer = current_photographer
> >>   end
>
> >> then it goes to Admin::PhotographersController#update :
>
> >>   def update
> >>     @photographer = current_photographer
> >>     if params[:id]
> >>       # trying to update a specific photographer on a singular
> >> resource is a no-no
> >>       flash[:notice] = "You can only update your own settings!"
> >>       redirect_to edit_resource_path
> >>     else
> >>       update!{ edit_resource_path }
> >>     end
> >>   end
>
> >> here is the controllerhttp://pastie.org/1189038
> >> and here it is the viewhttp://pastie.org/1189061( ... or, follow a
> >> snap )
>
> >> = form_for(:photographer, @photographer, :url => resource_path, :html
> >> => { :multipart => true, :method => :put }) do |f|
> >> ...
> >> ...
> >>     %p
> >>       = f.label :theme
> >>       = f.select :theme, Photographer.themes
> >>     %p
> >>       = f.label :use_watermark, "Automatically watermark your client
> >> photos?"
> >>       = f.check_box :use_watermark
> >> ...
>
> >> Luca
>
> >> On Sep 29, 10:06 am, Frederick Cheung <frederick.che...@gmail.com>
> >> wrote:
>
> >>> On Sep 28, 9:54 pm, lgs <luca.so...@gmail.com> wrote:
>
> >>>> After migrating my 2.3.9 app to rails 3.0.0 I get this error:
>
> >>>>       Completed 406 Not Acceptable in 513ms
>
> >>>> I also noted that processing controller doesn't output the protocol:
>
> >>>> -- Processing by Admin::PhotographersController#update as
>
> >>>> while if it works, say:
>
> >>>> -- Processing by Admin::PhotographersController#update as HTML
>
> >>>> Here is the full action outputhttp://pastie.org/1187051
>
> >>>> Can anyone help me, please ?
> >>>> Don't know where to start :-(
>
> >>> At a guess it's because the url being posted to is /admin/photographer.
> >>> 1 which may be making part of rails think that the requested format
> >>> is .1 (as opposed .html, .xml etc), so when you get to your respond_to
> >>> block rails can't generate a response and so generates a 406 instead
> >>> (which is http for "I can't generate the kind of response you asked
> >>> for")
>
> >>> Fred
>
> >>>> Luca
>
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby 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+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Dear all

Actually I would like to know how to send the picture name in the xml
response

fox example picture = Picture.find(params[:id])

Here i need to send the picture.id in the xml response...

Please tell me that how can i go with it...
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Parker Selbert wrote:
> Naif Dalbahi wrote:
>> I am so angry that the extension change was never mentioned in rails 3
>> documentation site... how are people supposed to know about that if the
>> development team doesn't announce that?!
>
> This isn't a new change at all, and especially not specific to Rails 3.
> The code you had inside of your js.erb template was RJS code, which will
> really limit you in places. The appropriate javascript equivalent inside
> of your js.erb template would be:
>
> $('#listing')
> .replace("<%= escape_javascript(render :partial => 'list', :locals =>
> { :articles => @articles }) %>");
>
>
> Note that is jQuery and not Prototype, but it applies regardless.
> Embrace the Javascript!

Thank you Fred & Parker... You guys are awesome!.. I guess I haven't
kept track of rails over the past years....
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Naif Dalbahi wrote:
> I am so angry that the extension change was never mentioned in rails 3
> documentation site... how are people supposed to know about that if the
> development team doesn't announce that?!

This isn't a new change at all, and especially not specific to Rails 3.
The code you had inside of your js.erb template was RJS code, which will
really limit you in places. The appropriate javascript equivalent inside
of your js.erb template would be:

$('#listing')
.replace("<%= escape_javascript(render :partial => 'list', :locals =>
{ :articles => @articles }) %>");


Note that is jQuery and not Prototype, but it applies regardless.
Embrace the Javascript!
--
Posted via http://www.ruby-forum.com/.

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