I'm having trouble accessing paperclip file attributes in an
after_destroy callback on my attachment model. I can't seem to access
the paperclip-managed attributes but I can access non-paperclip
attributes. Here's an example:
class AttachmentObserver < ActiveRecord::Observer
def after_destroy
If I'm following you correctly, check out the RailsSpace book site.
You can download the final application. In the application, look at
the comments conroller in the create action. He's checking for
duplicates and throwing them out if so.
http://www.railsspace.com/
I hope that's what you meant
a mess on your
> hands, as the two months where DST changes won't have a consistent
> offset...
>
> --Matt Jones
>
> On Sep 3, 9:39 pm, JL Smith wrote:
>
> > Yeah, I tried that in my example that I posted but the results aren't
> > then converted back to
, 11:54 am, Matt Jones wrote:
> This looks like an instance of this bug:
>
> https://rails.lighthouseapp.com/projects/8994/tickets/2946
>
> The quick way to fix it in this case is to convert the incoming
> datetime objects to UTC in timeline_created_products.
>
> --Matt Jone
You want the controller to responsible for passing model data from the
database to the view and vice versa. You don't want to clutter the
controller with model specific logic...that's why you want it in the
model where it's self-contained. Try this article:
http://www.therailsway.com/2007/6/1/r
That logic applies to all the databases. The moment you use
proprietary database functions in your SQL, you have just locked
yourself in to using that database vendor. That same function may or
may not exist with another database vendor. Not that it's a bad
thing, just that your code is not dat
Incompatible with production DB? Rails/ActiveRecord is database
independent (as long as you aren't using proprietary functions in raw
SQL queries). The code you wrote in development against a SQLite
database will work with MySQL, Oracle, Postgresql, etc. in production
with simply a change to dat
I guess I didn't clarify that...I'm simply saying that I use SQLite
for development because it's so lightweight and easy to setup. The
firefox plugin is icing on the cake.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Grou
No, RubyMine is not free. But it's also not an editor, like
KomodoEdit. KomodoEdit simply supports multiple languages for syntax
highlighting and such. RubyMine was built specifically for the Rails
framework, in addition to ruby of course. KomodoEdit knows nothing
about Rails, not to my knowle
You have to create a new project using existing source. Just go
through the new project wizard in either of those IDE's to create your
new project, just using existing source code.
But speaking of IDE's, if you haven't tried RubyMine, you're missing
out. I've used both Aptana Radrails and Netbe
And don't forget the SQLite Manager Firefox plugin:
https://addons.mozilla.org/en-US/firefox/addon/5817
I used to be dead set on installing and developing on MySQL...no more
of that. SQLite is too easy to work with...lightweight, no
headaches. And the Firefox plugin is the complete interface t
I'm having some trouble getting activerecord to adhere to my timezone
settings when finding objects based on its created_at field. I
understand that datetime fields are stored in UTC but it doesn't
convert the datetimes when it performs the lookup. I basically
followed Railscasts #106 and I'm us
I'm trying to gather and display some simple statistical data. I want
to display the number of Products created over the last month, grouped
by the day they were created. Am I on the right track as far as the
ActiveRecord finder and also how would I iterate over the results in
the view to spit o
Oh, and the links you posted in the first post don't specify a
controller so it assumes those actions all belong to the current
controller which obviously is not the case...so you need to add the
site controller to the links:
<%= link_to_unless_current "Help", :controller => 'site', :action =>
'h
The user controller needs to have the register action. Also run
rake:routes to make sure you've got wired correctly.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group,
Rails 3.0 is still in development so I doubt anyone has completed a
book on it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@google
Have you run all the necessary database migrations? Does the books
table have the title and price columns?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send emai
Is this what you're trying to do?
http://railscasts.com/episodes/88-dynamic-select-menus
--~--~-~--~~~---~--~~
You received 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
And I also made it all work via ajax using this simple railscast:
http://railscasts.com/episodes/174-pagination-with-ajax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this g
Here's how I implemented something similar.
On the index page of my contacts, I list them alphabetically by
default, paginated with 10 per page. At the top of this index page, I
spit out the alphabet with each letter having it's own link. Click
any letter and I return all the contacts whose las
+1 for RubyMineworth way more than the $50 I spent on it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsu
They could have also hit the 'enter' key multiple times too, not
clicking anything.
But in either case, a small amount of javascript will prevent this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails:
I'd suggest keeping that logic in the model...maybe create a method on
your model for getting "grand_total".
This blog post should give you a better idea of why you'd want this
kind of logic in the model:
http://railstips.org/2008/12/30/move-it-to-the-model-and-use-tiny-methods
--~--~-~-
http://wiki.rubyonrails.org/getting-started/installation/windows
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To u
Since you're new to RoR, why not use a plugin like Paperclip? It does
exactly what you're trying to do and much more...should save you a lot
of time.
http://www.thoughtbot.com/projects/paperclip
http://railscasts.com/episodes/134-paperclip
--~--~-~--~~~---~--~~
Y
<%= chapter_form.submit "Create", :class => "my-css-button-class" -%>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
http://railscasts.com/episodes/174-pagination-with-ajax
or
http://asciicasts.com/episodes/174-pagination-with-ajax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group,
I see what you're saying. I need to redirect from comments controller
right back to where I was (show action of movies controller). But
with the render, how do I specify the id to the movie that I'm
returning to? Thanks for the help.
--~--~-~--~~~---~--~~
You rec
I'm trying to get error messages from a child object to show up on the
view page of the parent object. Line #7 of show view is what I'm
trying to do. What am I missing? If I enter a comment that is less
than 30 characters, I should see some validation errors, no? Thanks
for any help.
http://g
So I'm trying to follow along in Chad Fowler's Rails Recipes (recipe
#59, Keeping track of who did what) and I simply want to access the
current user from within my cache sweeper. Normally you just
reference @current_user but that doesn't seem to be the case here.
In Chad's example, he calls con
Here's a couple of sites that show you what the "cool kids" are
using...ruby-toolbox.com has a subsection on CI.
http://ruby-toolbox.com/
http://rubytrends.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
Looks fine to me...what are you expecting the route to be?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubsc
Are you talking about singular resources?
http://guides.rails.info/routing.html#singular-resources
If not, you may want to show how you're declaring your route...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
Yeah, another user can update somebody's post but I don't think that
even matters in this case (think of this as having multiple admins
editing posts). The alerts table still needs to connect both the user
and the post so that a user other than the user that created the post
can enable an alert o
I'm building a blog application that allows users to create and edit
blog posts. I want to add the ability for a user to check a box on
the post page that enables an alert on the post that sends an email to
the user when the post is updated.
I would think my alerts table would simply consist of
Thanks for the help guys.
However, I've now hit the trap where I need session data in the
observer (who is changing the model)...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post t
That's a great point Philip. I'm actually trying to solve that very
problem in a project I'm working on.
I want to be able to do exactly what lighthouseapp does when it logs
ticket updates. In that case, you have comments that people can make
on a ticket. But when someone updates the ticket, I
First, get familiar with model callbacks if you're not already because
you don't want to put this logic in the controller:
http://guides.rails.info/activerecord_validations_callbacks.html#callbacks-overview
Then check out the dirty object feature that ActiveRecord provides and
how to use it:
ht
I would go with the observer so you can keep the logic in the model
(observer)...skinny controllers, fat models and all.
http://guides.rails.info/activerecord_validations_callbacks.html#observers
--~--~-~--~~~---~--~~
You received this message because you are subsc
That's exactly why I'm saying not to waste your time...Rails lays it
down in XHTML syntax so if he changed the doctype from XHTML specific,
then his validation won't work. Hence, don't waste your time changing
it if you're not worried about validation.
On May 27, 3:27 pm, Hassan Schroeder
wrot
Trying to change the way Rails lays down a stylesheet include is
really a waste of time. This HTML vs XHTML syntax only matters if
you're validating...otherwise, the browser renders it as HTML.
Don't waste your time and definitely update your browser.
--~--~-~--~~~---
What's the best way to examine what fields on a model are changing?
Would you use a callback to do that and how?
I guess the simplest example of this is how lighthouseapp documents
changes that a person makes to a ticket:
Milestone changed from “2.x” to “3.0”
State changed from “new” to “open”
Those instructions you linked to aren't platform specific. To install
Rails on Windows, try the steps outlined in the first section of this
article:
http://www.smashingmagazine.com/2009/03/27/ultimate-beginners-guide-to-ruby-on-rails/
--~--~-~--~~~---~--~~
You rec
Why are you expecting a rails plugin to provide an xhtml navigation
menu? Why not just implement the drop down menu using simply xhtml
(lists) and css?
Try this:
http://www.lwis.net/free-css-drop-down-menu/
Specifically:
http://www.lwis.net/free-css-drop-down-menu/dropdown.ultimate.linear.html
http://guides.rails.info/form_helpers.html#making-select-boxes-with-ease
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.
Another similar method...
def show_flash
[:notice, :warning, :message].collect do |key|
content_tag(:div, flash[key], :class => "flash_#{key}") unless
flash[key].blank?
end.join
end
--~--~-~--~~~---~--~~
You received this message because you are subsc
This should get you going...also check out the links at the end under
"Resources".
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ru
After updating my tickets resources in my routing config like Andrew
suggested, does anyone know how I might pass the :id param to the show
method from the new search method so I don't have to re-write the code
in the show method? All I want to do is reuse the show method...it's
doing exactly
named route is
> doing.
>
> What you need is something like this:
>
> # tickets_controller
> def search
> show
> end
>
> # routes.rb
> map.resources :tickets, :collection => { :search => :post }
>
> You can now GET or POST to /tickets/search or tick
What am I doing wrong? I just want to create a simple form where I can
enter the ID of a model and it take me to that model. I'm trying to
place the form in the application layout, so I can use it from anywhere
in my app. I'm using restful routes only. I keep getting this routing
error when tr
Besides the example depot application, I can't imagine the book
covering a great deal more than the new rails guides:
http://guides.rubyonrails.org/
On Nov 11, 6:20 am, bena <[EMAIL PROTECTED]> wrote:
> I'm an experienced programmer, working for a lot of years in the
> industry, and have been l
<%h f.body%> won't work?
On Nov 5, 11:42 pm, "Ishara Gunathilake" <[EMAIL PROTECTED]>
wrote:
> i hav a this code
> <%h f.body%>
> which shows some texts which are retrieved from
> a table..i want to wrap the texts,,i cant add div tag to
> between that code. please can anyone help me to solve thi
This sounds like the dirty object feature of Rails 2.1 would work
great:
http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects
Maybe even try to utilize some callback methods so you can capture and
display the changes to the user:
http://railsforum.com/viewtopic.php?id=2
I'm trying to decide which attachment plugin best suites the needs for
my project. I have a model that I want to associate one or many
attachments to. The content-type of the attachment will vary as well
(pdf, jpeg, doc, zip), not just an image type. Thanks for any help!
--~--~-~--~
54 matches
Mail list logo