Carl-Gustaf Harroch
2006-Dec-12 20:15 UTC
Re: FlexImage issue with belong_to model in session
This is related to flexImage I beleive. Any ideas? On 12/12/06, Carl H. <charroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > I have the following 2 models: > > class ShopLogo < FlexImage::Model > belongs_to :shop > end > > and > > class Shop < ActiveRecord::Base > has_one :shop_logo > end > > One of my controller upload a file to the db but does not save it with > the shop, thus the shop_id is set to 0. we have: > > def upload_logo > if request.post? > @logo1 = ShopLogo.create(:data => params[:image][:data]) > session[:logo1] = @logo1 > end > end > > When I try to access @logo1 in the view and session[:logo1], I get a > nil value. Thus I can not get the id for that entry in the db. The > session looks like the following: > > :logo1=> > #<ShopLogo:0x3644788 > @attributes> {"shop_id"=>0, > "id"=>1, > "data"=> #the binary data for the code... > > Thus @logo1 and session[:logo1] is set to nil. But from the above I can > see the ShopLogo model. Would anybody know how I can access the value > ''id''. I can not figure out where the problem lies. Methods for @logo1 > shows the methods for nil so I am quite lost... > > Any help is much appreciated, > > BR, > Carl > >-- Carl-Gustaf Harroch --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Carl-Gustaf Harroch
2006-Dec-12 20:43 UTC
Re: FlexImage issue with belong_to model in session
My bad, I did a redirect_to instead of render... /Carl On 12/12/06, Carl-Gustaf Harroch <charroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is related to flexImage I beleive. Any ideas? > > On 12/12/06, Carl H. <charroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello, > > I have the following 2 models: > > > > class ShopLogo < FlexImage::Model > > belongs_to :shop > > end > > > > and > > > > class Shop < ActiveRecord::Base > > has_one :shop_logo > > end > > > > One of my controller upload a file to the db but does not save it with > > the shop, thus the shop_id is set to 0. we have: > > > > def upload_logo > > if request.post? > > @logo1 = ShopLogo.create(:data => params[:image][:data]) > > session[:logo1] = @logo1 > > end > > end > > > > When I try to access @logo1 in the view and session[:logo1], I get a > > nil value. Thus I can not get the id for that entry in the db. The > > session looks like the following: > > > > :logo1=> > > #<ShopLogo:0x3644788 > > @attributes> > {"shop_id"=>0, > > "id"=>1, > > "data"=> #the binary data for the code... > > > > Thus @logo1 and session[:logo1] is set to nil. But from the above I can > > see the ShopLogo model. Would anybody know how I can access the value > > ''id''. I can not figure out where the problem lies. Methods for @logo1 > > shows the methods for nil so I am quite lost... > > > > Any help is much appreciated, > > > > BR, > > Carl > > > > > > > -- > Carl-Gustaf Harroch >-- Carl-Gustaf Harroch --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---