Displaying 20 results from an estimated 200 matches similar to: "Removing One Element From a Serialized Form"
2007 Jun 12
1
alias_method_chain and Class methods (a Ruby question)
Hello list,
I am trying to override the post_form method of Net::HTTP so that it
does something before actually doing the post. I tried the following
in environments/development.rb
module Net
class HTTP
alias_method_chain :post_form, :intercept
def post_form_with_intercept(url, params)
# Do something before post
logger.info(''About to post at
2008 Feb 26
1
problem with posting with acts as taggable on steroids
hi all
i''m trying to have a post with tags included but i''m getting
undefined method `tag_with''
i''ve already added acts_as_taggable to the model
and on the controller the code for creating the post is:
def create
@post = Post.new(params[:post])
@post.tag_with(params[:tag_list])
@post.user = current_user
if @post.save
redirect_to
2006 Nov 17
3
acts_as_ferret + :tag_list, how to use it?
hello,
i am currently using acts_as_ferret in one of my applications and now
would like to also incorproate tags. i came across somesones blog that
had this:
//////
Having Ferret index method results (like :tag_list) worked
out-of-the-box for me with acts_as_ferret. I specified attributes (table
columns) as strings and methods as symbols, like so:
acts_as_ferret :fields => [?title?,
2006 Mar 19
1
Sending post request with post_form
Basically I have a controller with this:
@lang = params[''lang''] || ''en''
@errors = request.raw_post
@feed_stats =
Net::HTTP.post_form(URI.parse("http://www.google.com/tbproxy/spell?lang="
+ @lang), @errors)
render :text => @feed_stats
However whenever I run this I get an error message:
undefined method `post_form'' for Net::HTTP:Class
2009 Jan 01
1
HasManyThroughCantAssociateNewRecords Exception
I have a model:
class Video < ActiveRecord::Base
has_many :video_tags
has_many :video_types
has_many :tags, :through => :video_tags, :uniq => :true
has_many :types, :through => :video_types, :uniq => :true
def get_tag_list(delimiter)
tags.collect { |t| t.tag }.join(delimiter)
end
def set_tag_list(tag_list, delimiter)
# doesn''t remove old tags
2010 Apr 22
0
How to automatically set params based on passed object when generating a route?
Hi,
having i.e. a post model that has many categories - is it possible for
member routes like i.e. post_path(post) to generate path like "/
posts/:post_category_name/:post_id" without manually passing the
category param? Does anyone know if there''s a gem or if I can simply
override the post_url method to automatically set category from post
object?
The best I could get right
2008 Dec 11
1
help needed regaring Acts As Taggable On Steroids
Hello,
In my rails application, I have a book model.
I want to add tags. For that I have installed
acts_as_taggable_on_steroids from this link
http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids
and do as the readme file.
This is my Model :
class Book < ActiveRecord::Base
acts_as_taggable
end
Here is my ApplicationHelper :
module
2010 May 17
2
"end of file" error for "net/https"
Hi,
I have written following code:-
It is working fine for http protocol. But whenever I am doing for https
I getting an error "end of file reached".
Can anyone tell me what is wrong with the code?
def email_to_friend
require ''net/http''
require "net/https"
require ''uri''
#res =
2008 Jan 21
2
multiple ids on restful action
Hi,
I know this question has come up before, but I couldn''t find a
satisfying answer.
Maybe I didn''t look well enough, so any pointers to old messages
regarding this subject would be welcome too.
I need some way to pass multiple ids to a resource.
Something like /posts/13,14
If I do this I have to manually split the id on ","s in the action,
and use
post_path([post1,
2010 Sep 01
4
NoMethodError: undefined method `force_encoding' for "Conten
Hi everyone!
Im trying to install mechanizer from
http://github.com/tenderlove/mechanize.
I`ve clone the project into /tmp folder. When I do rake inside the
folder /tmp/mechanizer it gives me this error:
mac159180:mechanize renatosis$ rake
(in /private/tmp/mechanize)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w
-Ilib:bin:test:. -e ''require "rubygems";
2006 Sep 18
3
Automatic reindexing of associated columns acts_as_taggable
Hi,
So i''m trying to use acts_as_taggable with the acts_as_ferret plugin,
where I have Post.rb model, which has a method tag_list made available
through acts_as_taggable, as returns a string of associated tag words
from the tags table (tag.rb). I''ve set up my Post.rb model in the
following way.
class Post < ActiveRecord::Base
acts_as_taggable
acts_as_ferret
2009 Jun 05
1
Slow/unpredictive response of post_form from rails lib
Hi friends,
I''m facing a very strange problem...
I consume a webservice from within my rails app. I''ve written a thin
wrapper around the webservice using Net::HTTP.post_form
However, when calling the API from within my controllers, the API calls
randomly fail, complaining about timeout.
But - when I wrote a simple iterative test (500 iterations), calling the
same webservice
2008 Apr 30
3
pretty url
I want to write a permalink like /year/month/day/title, code is as follows:
self.permalink = "#{now.year}/#{now.month}/#{now.day}/#{title}"
in the view, I use restful url post_path(@post). And in the html source
code, the url is /posts/2008%2F4%2F30%2FTest
You can see, the ''/'' is replaced by "%2F", which is not I expect.
How not to replace the
2006 Nov 04
0
Net::HTTP.post_form got 200 but no INSERT INTO. How come? How to fix this?
Hello,
I''m playing around with net/http and open-uri Ruby Libraries.. I''m
trying to post to my own rails simple new action method.
Here''s my irb :
irb(main):013:0> res =
Net::HTTP.post_form(URI.parse("http://localhost:3002/blog2/new"),
{"commit" => "Save",
"signature_id" => "", "signature_content"
2006 Nov 30
0
Query string based on the selection in HTTP POST
I want to generate the query string based on the options selected. For
example
it could be www.test.com/search?id=1 or
www.test.com/search?id=1&zip=60008. How could I achieve this using
http::POST?
I tried the following, which didn''t work
url = "{''id'' => 1, ''zip'' => 60008}"
res =
2006 Dec 26
0
acts_as_taggable Plugin issue (not gem)
I tried to post this earlier, but it never came through. I''ve got
something working in console, but not in controller. Any idea why?
This is the plugin not the gem of acts_as_taggable
*View*
<code>
<h1>Listing elements</h1>
<% if @elements.blank? %>
<p>There are currently no elements in the system tagged <%=
2006 Aug 07
3
Acts_as_taggable / Rails Recipes bug?
I''m following the acts_as_taggable chapter from the Rails Recipes book.
I want my view form to have a text_field that correlates to an attribute
in the Model that accepts a string of space delimited tags. The book
uses tag-_list, but from what I can tell this attribute can''t be written
to. I''ve added this to the plugin code itself - am I missing something,
is there a
2006 Apr 29
0
Trouble with firefox and AJAX
I''ve been creating my own message board in rails as a learning
exercise. I''m currently trying to implement posting using AJAX, so the
topic page as a whole doesn''t need reloading.
What I''ve written works as epected in IE6 and Safari, but the AJAX
call fails silently in Firefox 1.5 -- although the server has logged
the request, the "success" callback
2012 Feb 16
3
Mechanize::ResponseCodeError: 500
> Excuse me if my issue is a little bit application-specific. I need
> Mechanize to submit bunch of data from our server to an online reservation
> system. The url is https://secure.mdausa.org/donate/
> It works in my browser however using mechanize following error appears:
>
> /Library/Ruby/Gems/1.8/gems/mechanize-2.0.1/lib/mechanize/http/agent.rb:241:in
> `fetch'':
2008 Jan 14
3
Reading HTTP Request parameters
Hello
I''ve a client which send this request to a mongrel HTTPHandler :
res=Net::HTTP.post_form(URI.parse(''http://localhost:3000/test''),{"a"=>1,"b"=>2})
But in the handler I can''t read the parameters one by one, I can read
the entire String only :
class Serveur
class MyHandler < Mongrel::HttpHandler
def process(req, resp)