Sorry, I've moved beyond that by adding this to all my controllers:

config.show.link.inline = false
config.update.link.inline = false
config.create.link.inline = false
config.delete.link.inline = false

But then I lose the ajax-y stuff, which is unfortunate.

This appears to be the area it was occurring, but I don't see anything
very helpful (I removed all the lines that said ***** Debugger
requested, but was not available: Start server with --debugger to
enable ***** since this was at the point it was doing that like crazy
still before it was removed)


Processing UniversesController#index (for 127.0.0.1 at 2009-05-24
21:42:30) [GET]
  Parameters: {"action"=>"index", "controller"=>"universes"}

   [4;36;1mUser Load (0.4ms) [0m    [0;1mSELECT * FROM "users" WHERE
("users"."id" = 1)  [0m


   [4;35;1mSQL (0.2ms) [0m    [0mselect sqlite_version(*) [0m
   [4;36;1mSQL (0.3ms) [0m    [0;1mSELECT count(DISTINCT
"universes".id) AS count_all FROM "universes" LEFT OUTER JOIN "users"
ON "users".id = "universes".creator_id  [0m
   [4;35;1mUniverse Load (0.4ms) [0m    [0mSELECT "universes".* FROM
"universes" ORDER BY universes."id" ASC LIMIT 15 OFFSET 0 [0m
   [4;36;1mCACHE (0.0ms) [0m    [0;1mSELECT * FROM "users" WHERE
("users"."id" = 1)  [0m


Rendering template within layouts/application
Rendering list


   [4;35;1mSQL (0.2ms) [0m    [0mSELECT count(*) AS count_all FROM
"universes"  [0m
Rendered _list_header (3.3ms)
Rendered _list_column_headings (4.4ms)
Rendered _messages (0.8ms)

current user id = 1, creator id = --- !ruby/object:Universe
attributes:
  name:
  created_at:
  updated_at:
  creator_id:
  description:
attributes_cache: {}

new_record: true

Rendered _list_actions (4.3ms)
Rendered _list_record (11.2ms)
Rendered _list (29.0ms)
Completed in 128ms (View: 118, DB: 2) | 200 OK [http://0.0.0.0/]


Processing UniversesController#index (for 127.0.0.1 at 2009-05-24
21:42:47) [GET]
  Parameters: {"action"=>"index", "controller"=>"universes"}

   [4;36;1mUser Load (0.5ms) [0m    [0;1mSELECT * FROM "users" WHERE
("users"."id" = 1)  [0m



***** Debugger requested, but was not available: Start server with
--debugger to enable *****

   [4;35;1mSQL (0.1ms) [0m    [0mselect sqlite_version(*) [0m
   [4;36;1mSQL (0.2ms) [0m    [0;1mSELECT count(DISTINCT
"universes".id) AS count_all FROM "universes" LEFT OUTER JOIN "users"
ON "users".id = "universes".creator_id  [0m
   [4;35;1mUniverse Load (0.2ms) [0m    [0mSELECT "universes".* FROM
"universes" ORDER BY universes."id" ASC LIMIT 15 OFFSET 0 [0m
   [4;36;1mCACHE (0.0ms) [0m    [0;1mSELECT * FROM "users" WHERE
("users"."id" = 1)  [0m

Rendering template within layouts/application
Rendering list

   [4;35;1mSQL (0.2ms) [0m    [0mSELECT count(*) AS count_all FROM
"universes"  [0m
Rendered _list_header (6.2ms)
Rendered _list_column_headings (5.3ms)
Rendered _messages (1.0ms)

current user id = 1, self stats = --- !ruby/object:Universe
attributes:
  name:
  created_at:
  updated_at:
  creator_id:
  description:
attributes_cache: {}

new_record: true

Rendered _list_actions (4.7ms)
Rendered _list_record (13.8ms)
Rendered _list (31.8ms)
Completed in 149ms (View: 138, DB: 1) | 200 OK [http://0.0.0.0/]

I have been working on this and committing it to Github, so you could
check out an older commit and see exactly what is going on if you
wanted.

http://github.com/nextekcarl/storylines/tree/master

Carl

On Tue, May 26, 2009 at 3:01 PM, G. Sobrinho <[email protected]> wrote:
> Post the log, the code "smell" good
>
> 2009/5/25 Carl <[email protected]>
>>
>> I am sort of able to get it to work by creating:
>>
>> before_filter :authorized?, :only => [:update]
>>
>> def authorized?
>>   �...@universe = Universe.find(params[:id])
>>    unless @universe.creator_id == session[:user_id]
>>      flash[:notice] = "Only the creator of a Universe may modify it."
>>      redirect_to :controller => :universe
>>      return false
>>    end
>>  end
>>
>> But that just causes an ugly internal 500 error rather than rendering
>> the flash or actually redirecting since it is an ajax call. Any ideas
>> about how to make this work better?
>>
>> Carl
>>
>> On May 25, 7:59 am, Carl <[email protected]> wrote:
>> > Hmm, do you have any suggestions about how to do what I need done? I
>> > tried to use "before_update_save(record)" in the controller, but it
>> > must check that after validations because adding validation errors
>> > didn't stop it from working. I have the feeling I'm missing something
>> > small but really important here since there must be plenty of other
>> > people who have the same problem. Thanks.
>> >
>> > Carl
>> >
>> > On May 25, 7:03 am, "G. Sobrinho" <[email protected]> wrote:
>> >
>> > > Hello Carl,
>> >
>> > > I think the Active Scaffold doesn't support authorized_for_action? on
>> > > each
>> > > record, only on all... But, i can wrong.
>> >
>> > > I will check that and notify you
>> >
>> > > 2009/5/25 Carl <[email protected]>
>> >
>> > > > I'm using the master trunk of AS with Rails 2.3.2
>> >
>> > > > In one of my models I need to prevent the user from modifying the
>> > > > model unless the current_user.id == creator_id. I am using the
>> > > > nifty_authentication generator so I thought that perhaps the
>> > > > current_user wasn't being passed through so I added a logger
>> > > > statement
>> > > > to test things and I've run into something odd. Here's the code in
>> > > > my
>> > > > model:
>> >
>> > > > class Universe < ActiveRecord::Base
>> > > >  has_many :permissions
>> > > >  has_many :users, :through => :permissions
>> > > >  belongs_to :creator, :class_name => "User", :foreign_key
>> > > > => :creator_id
>> >
>> > > >  def authorized_for_update?
>> > > >    logger.error "current user id = #{current_user.id}, self stats =
>> > > > #
>> > > > {self.to_yaml}"
>> > > >    return false unless current_user.id == self.creator_id
>> > > >  end
>> > > > end
>> >
>> > > > The logger statement reads like this in the log (there is currently
>> > > > only one model in the database of this type currently):
>> >
>> > > > current user id = 1, self stats = --- !ruby/object:Universe
>> > > > attributes:
>> > > >  name:
>> > > >  created_at:
>> > > >  updated_at:
>> > > >  creator_id:
>> > > >  description:
>> > > > attributes_cache: {}
>> >
>> > > > new_record: true
>> >
>> > > > So current_user.id is being set correctly, but shouldn't this have
>> > > > the
>> > > > stats for the current model in it rather than a blank model? The
>> > > > model
>> > > > in question should be showing up like this:
>> >
>> > > > --- !ruby/object:Universe
>> > > > attributes:
>> > > >  name: Avatars
>> > > >  created_at: 2009-05-24 21:32:38
>> > > >  updated_at: 2009-05-25 01:53:56
>> > > >  id: "1"
>> > > >  creator_id: "1"
>> > > >  description: blah, blah
>> > > > attributes_cache: {}
>> >
>> > > > If anyone has any idea what I'm doing wrong here I'd really
>> > > > appreciate
>> > > > it.I've looked through the other posts on here and it seems like it
>> > > > should be working.
>> >
>> > > --
>> > > Atenciosamente,
>> >
>> > > Gabriel Sobrinho
>> > > [email protected]
>> > > +55 31 8775-8378
>>
>
>
>
> --
> Atenciosamente,
>
> Gabriel Sobrinho
> [email protected]
> +55 31 8775-8378
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to