Joined January 2014

Sebastián González

Viña del Mar, Chile

Hi manikantasai, please write your question in StackOverflow, where you can add the code in context (which make the analysis easier) and reach a higher audience.

I don't understand this part:

uses a lot of js code to implement on the fly input for the select menu

Are you using custom javascript for input and select2 at the same time?
Anyway, getting the ids as an array is not the desired behaviour? What exactly are you aiming to receive from the input?

This is where you have to get creative with your javascript. Instead of using the remote: trueoption, I'd use an ajax call, withdataType: 'script'` so I can capture the Javascript behaviour returned by the controller, and/or complementing it with the logic in the success function.
With the ajax call you have greater freedom for sending parameters with the call (maybe a data-something field with the id?). If you somehow decide to send an identifier, you'd have to capture it in the controller and then use it in the response to successfully identified the correct element.

That's weird...Thank you for the feedback!

Thanks nruth! I wrote this down because I couldn't find anything like it.
Hopefully, people won't have to do the same long research I had to do!

As it's pointed out just beneath the routes file, the remote: true hash tell Rails that the anchor element must respond in Javascript format (triggerin the Ajax logic), instead of the usual HTML.

Note that the controller method has to respond in this format also, otherwise is of no use.

In Rails, you control the routes in the routes.rb file. I will add it to the pro tip.

Posted to Editing Google Docs with vim over 1 year ago

This seems really useful. Thanks for the tip!

Posted to Rails: Casting Objects as Arrays over 1 year ago

Very succint!

What is exactly not working? Are the messages being displayed without additional classes or no messages at all?

Nice! And for other frameworks such as Semantic-UI is almost the same. Thanks!

Posted to Layout "hell" in Rails over 1 year ago

Does this behave well with, say, the Semantic-UI or another front-end framework classes? I'm trying layouting from Controllers and Namespaces and it's pure hell with those.

Succinct, very quick to implement, and most importantly, NO DEVISE!

Will recommend! Thanks!

1,405 Karma
111,104 Total ProTip Views