Search Results

Search found 2 results on 1 pages for 'ferparra'.

Page 1/1 | 1 

  • Authlogic with nested attributes and polymorphic associations

    - by ferparra
    Hi all! I'm having trouble with the following code: User < AR acts_as_authentic belongs_to :owner, :polymorphic => true end Worker < AR has_one :user, :as => :owner accepts_nested_attributes_for :user end Employer < AR has_one :user, :as => :owner accepts_nested_attributes_for :user end I'd like to create registration forms based on user types, and to include authentication fields such as username and password. I currently do this: UserRegistrationController < AC #i.e. a new Employer def new @employer = Employer.new @employer.build_user end ... end I then include User fields with fields_for. All views render fine, but here's the catch: I cannot build a User, it tells me :password is a wrong method, so I guess the authentication logic was bypassed. What should I do? Am I doing it wrong altogether? Should I drop polymorphic associations in favor of Single Table Inheritance? Whatever I do, I have to make sure it plays nicely with Authlogic.

    Read the article

  • HTTPS and HTTParty - Timeout and EOF

    - by ferparra
    Hi all, I'm trying to post something to an HTTPS resource, but it seems it doesn't work. My code look something like this: require 'httparty' class MyClass include HTTParty base_uri "https://mydomain.com:8085/search" basic_auth 'admin', 'changeme' format :xml def mymethod self.class.post('/job', :query => {:search => "*"}) end end As you can see, I've defined an URI with 'https' included, so it should set the use_ssl property for the Net::HTTPS library automatically. For some reason, Net::HTTP is requested, and I never get in touch with the server, so I end up with an EOF. Any clues?

    Read the article

1