I'm going ahead with:
@link = @user.links.create!("url" => params[:url])
I also changed my routes.rb file to include these lines:
# map.resources :links
map.resources :users, :has_many => :links
It works, but I'm still having some trouble. With these lines
@link = @user.links.create!("url" => params[:url])
@link.title = title=(Hpricot(open(@link.url))/"title").inner_text
the action just repeats the URL as the title. Also, is there a way that
I can reuse the code from my create action:
def create
@user = current_user
@link = @user.links.create!(params[:link])
@link.title = title=(Hpricot(open(@link.url))/"title").inner_text
....
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---