SurveyMonkey: unique ID in Survey End Page URL - surveymonkey

On the Survey End Page of SurveyMonkey I need an URL with the unique ID of the Survey. Example: http://www.example.com?id={unique ID}
When a user is finished with his survey, I need to redirect the user to my site. My Site need to know the unique ID of the survey.
In SurveyMonkey it is possible to create a custom end page with a custom url, but I dind't figured out, how to add the unique ID to this custom URL.

Related

Pass id to new create form (but not through URL) - rails

I used the following advice to set up new_invoice_path in my app:
https://stackoverflow.com/a/14570788
How can I (using the outlined scenario in the question/answer I linked to above) make it so that when a user clicks a link to create a new invoice for a specific account the account_id passes to the form but does not show up in the URL?
I view the current solution (pass account_id to form via URL) as problematic because...
Someone could easily modify the URL and start creating invoices in different accounts.
It looks sloppy (especially if you start trying to pass things other than just account_id)

Obfuscate segment key in rails route

Say I have a route users/:id, where id = 1. Pretty standard, but I would like to change this route to the following:
/account
Where any logged in user, in this case a user with an id = 1, does not see their uid as the segment key, but instead a generic 'account' URI only. How can I achieve this in a rails 3 application?
You can create a route to a standard action which functions as a users own show action. E.g.: you create an action where you get the current user's information and make it shown. The current user can be extracted from the session as usual, so no need for sending out the user id in the url. And you only need a route which redirects /account to this action.

Ruby on Rails - Hide user_id in URL

I would like to hide the user_id in the URL if I can.
http://domain.com:3000/users/1
Here is the page info.
action: show
controller: users
id: '1'
The id in the URL is required so that the controller/action knows which user it should display on the page. It shows the user with an id of 1 in this case, but in other cases, you might want to show the details of another user.
It is possible to substitute the id in the URL with other identifying information, for example username.
To do this, see http://railscasts.com/episodes/63-model-name-in-url. You simply have to override the to_param method in your model.
There is a new Railscast that uses the friendly_id, a great gem that provides URL renaming:
http://railscasts.com/episodes/314-pretty-urls-with-friendlyid
To do this. In your user model make sure you have:
is_sluggable :whatever-attribute-you-want-to-mask-users/1
In your user controllers use:
#user = User.find_using_slug(params[:user])

Rails 3 + Tumblr API: How can I edit multiple posts at the same time with one form?

I'm trying to write a Rails app that fetches a user's Tumblr posts that match certain criteria (for example, only posts that contain certain tags). Once the posts are displayed, I want the user to be able to edit them all at once via one form submit button.
I am authenticating to Tumblr via OmniAuth and making API calls using the tumblr_client gem. See the source code here: https://github.com/monfresh/Fix-my-Tumblr-tags
So far, I've been able to display the correct data, and I am able to edit each post individually. What I don't know how to do is pass in the multiple post IDs as an array, so I can then process them in a loop. Is there a way to do this without creating a new Post model, i.e. without saving the user's posts to my database? Right now, I just have a User model.
I think I figured it out.
In my form_tag, I collect the post IDs in an array via checkboxes:
<%= check_box_tag "post_ids[]", m["id"] %>
and in my controller, I have an action that pulls in those post IDs like so:
def edit_tags
#user = User.find(params[:id])
#posts = params[:post_ids]
end

Rails - How can I set up an id as a token (pre-beta invitation application like usehipster)

I am trying to write a "viral" pre-beta invitation application as one can see on usehipster.com or fork.ly.
Basically, the future tester:
1.) enters his email
2.) is redirected to a view (a coming_soon page)
3.) receive a link like this one : "http://localhost:3000/?referred_to=the tester's invitation id" displayed in the view.
4.) and receive an email with the same link.
If I understand it well, the "tester's invitation id" acts as a token in order to track from which testers the invitation come from.
My questions:
1.) How can I generate the id in the link? I cannot use before_create cause the invitation id is not already set up when a tester registered.
I tried this:
in the invitation controller
def coming_soon
#invitation = Invitation.last
end
in views/invitations/coming_soon.html.erb
...
Copy and paste the following link to share wherever you want!</p>
<%= text_field_tag 'code', root_url + "?reffered_by=" + #invitation.id.to_s %>
Do you think they do like this?
2.) Why there is a question mark in the link? (or something like ?reffered_by= why not just root_url/#invitation.id.to_s) This is something related to the routes? is it a get method?
Thanks for your help!
I will answer question 2:
? in url is a way to pass parameters. A form using GET method uses this sort of appending to url to pass parameters. URL ?reffered_by=somevalue passes the parameter referred_by with value somevalue. Now if in our controller, we want this value, we can call params[:referred_by] and we will get the value as "somevalue". If we want to pass more than one parameter, we can pass it using &. For example,
"#{root_url}?referred_by=#{#invitation.id}&referred_time_stamp=#{Time.now.strftime(%Y%m%d%H%M%S)}"
Now, we can access these parameters in controller as params[:referred_by] and params[:referred_time_stamp].
If you have no routes or resources defined in routes.rb, you cannot pass parameters like id using
"#{root_url}/#{#invitation.id}". For example, when you define
map.connect ':controller/:action/:id'
in routes.rb, then it understands the part coming after last slash is the value of parameter id and we will get it as params[:id] in the controller.

Resources