Getting width and height of attachment

1 view
Skip to first unread message

#2Will

unread,
Jul 7, 2009, 1:27:31 AM7/7/09
to Paperclip Plugin
This thread explains whats going on with this, at least until a
solution is put into the paperclip master:


http://groups.google.com/group/paperclip-plugin/browse_thread/thread/50039909a58361e7/ac5f8cbc2479c8ad?show_docid=ac5f8cbc2479c8ad&pli=1#

In this thread felipe sugests doing this:

You could use this as an initializer.

http://gist.github.com/10790

That looks like a nice neat solution for someone like myself who
already has paperclip installed and dosn't want to get a fork of the
plugin installed.

However (neewbie question approaching) I'm making the tiniest little
application as my-first-rails-app and i can't work out where to put
this ( paperclip_initializer.rb ) file.

do i need to do anything else to get it working other than the changes
to the model that are nicely explained in the comments of that file?

Thanks a million for any replies.

Will

Kennon Ballou

unread,
Jul 7, 2009, 7:01:55 AM7/7/09
to papercli...@googlegroups.com
Initializers generally go in the directory config/initializers. I think
this has been the case since Rails 2.x (correct me someone if I'm wrong).

In any case, any .rb files placed in config/initializers will get run,
and so that's the best place to put stuff like this.

| Kennon Ballou
| Angry Turnip, Inc.

#2Will

unread,
Jul 7, 2009, 8:44:18 AM7/7/09
to Paperclip Plugin
Hay, thanks for getting back to me. Thats great.

I put it there, thinking "this is just too easy" and sure enough it
didn't work. But reading your comment i thought "i must be doing
something wrong"

And then it occured to me. "turn it off and turn it back on again" I
restarted the rails server in terminal, and hay presto its working.
Brilliant.

I didn't really realise rails has the app running in memory like
that....

Thanks again. Will.

On Jul 7, 9:01 pm, Kennon Ballou <ken...@angryturnip.com> wrote:
> Initializers generally go in the directory config/initializers. I think
> this has been the case since Rails 2.x (correct me someone if I'm wrong).
>
> In any case, any .rb files placed in config/initializers will get run,
> and so that's the best place to put stuff like this.
>
> | Kennon Ballou
> | Angry Turnip, Inc.
>
> #2Will wrote:
> > This thread explains whats going on with this, at least until a
> > solution is put into the paperclip master:
>
> >http://groups.google.com/group/paperclip-plugin/browse_thread/thread/...

Kennon Ballou

unread,
Jul 7, 2009, 8:52:13 AM7/7/09
to papercli...@googlegroups.com
Yep, a lot of the code is reloaded for each request in development mode
(generally anything in a controller or model), but stuff in an
initializer, the main config, or a plugin is only loaded on startup.

#2Will

unread,
Jul 7, 2009, 9:17:08 AM7/7/09
to Paperclip Plugin
Ah, OK. Cool. Id been wondering, since the quickstart says:
"In development mode (which is what you’re working in by default),
Rails reloads your application with every browser request, so there’s
no need to stop and restart the web server."
Reply all
Reply to author
Forward
0 new messages