I have two RoR3 application:
http://users.domain.local
http://profiles.domain.local
I created the 'users/models/profile.rb':
class Profile < ActiveResource::Base
self.site = "http://profiles.domain.local"
end
In 'profiles/models/profile.rb' I have:
attr_accessible :name
My profile's SQL table contains these columns:
- id
- name
- user_id
So if I run Profile.create(:name => "test_name")
a new profile will be created in http://profiles.domain.local
with the name "test_name".
For obvious security reasons, I don't want to make accessible the 'user_id' attribute, but I need to set that on the profile creation from the 'users' application.
I tryed a lot of way do make that, but I can't find an easy solution. Maybe, it is possible with an if
statement near the 'attr_accessible' of the 'profile' application that fill a request from the 'user' application.
Can somebody help me?