# Problem using attachment\_fu

**URL:** <https://www.ruby-forum.com/t/problem-using-attachment-fu/141298>\
**Category:** Rails\
**Created:** [June 24, 2008, 1:57pm UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298 "2008-06-24T13:57:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratnavel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Post date:** [June 24, 2008, 1:57pm UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298/1 "2008-06-24T13:57:38Z")

</div>

Hi,

I use attachment\_fu plugin to upload a remote file to file system.

It works fine with IE, If we use fire fox its coming out to login page  
throwing a exception  
“Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb559a28  
@filter=:login\_required\>] rendered\_or\_redirected.”

I use “acts\_as\_authenticated” plugin for authentication.

The reason i found is that its not taking the current user id from the  
session(Tried hardcoding the user.id in login\_from\_session method at  
authenticated\_system module its working fine).

Can some one help me in this issue.

Thanks,  
Ratnavel.

---

<div class="post-metadata">

**Author:** ![ratnavel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Post date:** [June 24, 2008, 3:05pm UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298/2 "2008-06-24T15:05:23Z")

</div>

Can you post some code?  
Your create acion or something?  
Oli  
Ratnavel P S wrote:

> Hi,
> 
> I use attachment\_fu plugin to upload a remote file to file system.
> 
> It works fine with IE, If we use fire fox its coming out to login page  
> throwing a exception  
> “Filter chain halted as  
> [#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb559a28  
> @filter=:login\_required\>] rendered\_or\_redirected.”
> 
> I use “acts\_as\_authenticated” plugin for authentication.
> 
> The reason i found is that its not taking the current user id from the  
> session(Tried hardcoding the user.id in login\_from\_session method at  
> authenticated\_system module its working fine).
> 
> Can some one help me in this issue.
> 
> Thanks,  
> Ratnavel.

---

<div class="post-metadata">

**Author:** ![ratnavel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Post date:** [June 24, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298/3 "2008-06-24T17:23:39Z")

</div>

> Can you post some code?  
> Your create acion or something?  
> Oli

This is my save method where i create a image and upload.

def save\_image  
test\_image = TestImage.new(:uploaded\_data =\>  
params[:RemoteFile],:user\_id =\> params[:user\_id] )

```
respond_to do |format|
  if test_image.save
    format.html{render :text=>"Success"}
  else
    format.html{render :text=>"Sorry!,Failed"}
  end
end

```

end

Its actually entering into the method and quiting back bcoz of  
authentication issue.

---

<div class="post-metadata">

**Author:** ![ratnavel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Post date:** [June 25, 2008, 7:01am UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298/4 "2008-06-25T07:01:12Z")

</div>

Any help in this regard???

---

<div class="post-metadata">

**Author:** ![ratnavel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6f9a4e/32.png) [@ratnavel](https://www.ruby-forum.com/u/ratnavel)\
**Post date:** [June 25, 2008, 12:08pm UTC](https://www.ruby-forum.com/t/problem-using-attachment-fu/141298/5 "2008-06-25T12:08:53Z")

</div>

Assuming you are using aaa for auth an you have a relationship set for

user has\_many testimages and testimages belongs\_to user, try this

def save\_image  
test\_image = current\_user.testimage.create  
params[:RemoteFile].merge(:user\_id =\> current\_user.id)  
respond\_to do |format|  
if test\_image.save  
format.html{render :text=\>“Success”}  
else  
format.html{render :text=\>“Sorry!,Failed”}  
end  
end  
end

Hope this helps

Oli  
Ratnavel P S wrote:

> Any help in this regard???
