Hi,
Started POST "/users/2-user-with-pages/pages" for 127.0.0.1 at
2011-01-29 01:45:40 +0000
SQL (0.9ms) SHOW TABLES
DEPRECATION WARNING: Base#before_save has been deprecated, please use
Base.before_save :method instead. (called from <class:User> at
/home/tfranco/imaginary.git/projects/pagepong/implementation/pagepong-rails-3/app/models/user.rb:37)
SQL (1.0ms) SHOW TABLES
SQL (0.9ms) SHOW TABLES
SQL (0.9ms) SHOW TABLES
SQL (0.9ms) SHOW TABLES
Processing by PagesController#create_for_user as HTML
Parameters: {"page_path"=>"/users/2-user-with-pages/pages/new",
"authenticity_token"=>"++ufrmncWJ7usOPCLIZveCygPh82ABMwTABCcJMGOWg=",
"page"=>{"user_id"=>"2", "name"=>"Topgim Production",
"url"=>"http://google.com"}, "user_id"=>"2-user-with-pages"}
User Load (1.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id`
= 2) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 2)
LIMIT 1
SQL (0.3ms) ROLLBACK
User Load (1.6ms) SELECT `users`.* FROM `users` LIMIT 30
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 2)
LIMIT 1
Rendered controller: pages; dryml-tag: new-for-user-page (226.3ms)
Completed 200 OK in 1162ms (Views: 709.5ms | ActiveRecord: 7.9ms)
Thanks,
TF
On 01/28/2011 10:54 PM, Henry Baragar wrote:
What does the log file say? It should provide some additional clues as
to what is happening.
Cheers,
Henry
On January 28, 2011 05:28:08 am Tiago Franco wrote:
> Hi,
>
> I have a model that calls the following method during validation:
>
> validate :is_reachable
>
> def is_reachable
> ping(false)
> errors.add(:url, "page is not reachable") unless self.status ==
> Page::Status::UP
> end
>
> def ping(notify_user = true)
> begin
> self.ping_at = Time.now + PING_INTERVAIL
> response = Net::HTTP.get_response(URI.parse(self.url))
> response.value()
> self.status = Page::Status::UP
> rescue Exception => e
> unless self.status == Page::Status::DOWN
> UserMailer.deliver_page_down(self, self.user) if notify_user
> self.status = Page::Status::DOWN
> end
> end
> end
>
> When the model is valid (i.e. exception is not raised and page is
> reachable, hobo renders user.page.show - correct.
>
> When the model is invalid (i.e. exception is raised, catched and
> errors.add executes), hobo renders the user.pages.index -wrong.
>
> Because the model is invalid, it doesn't get saved. Hobo should be
> serving user.pages.new again with the errors, but the rescue exception
> is affecting something.
>
> I'm not doing any overrides on the Pages controller. I have
> auto_actions_for :user, [ :index, :new, :create].
>
> Any clues? This is hobo 3 edge.
>
> Thanks,
> TF
--
Henry Baragar
Instantiated Software
--
You received this message because you are subscribed to the Google
Groups "Hobo Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.