How do I get SublimeLinter to stop reporting false-positive errors? - rvm

The problem is that SublimeLinter will sometimes report lines as containing errors, when they actually don't. One example of this is a line like format.html { redirect_to :action => :index }.

This is because SublimeLinter is using the system ruby, instead of the ruby for your gemset. See, the Ruby linter that SublimeLinter uses is extremely simple. It just runs the code through ruby -wc and marks any output in the code. But that's the problem. Sublime Text 2 isn't using the ruby that your Rails app uses.
You can change the SublimeLinter settings to correct this issue by opening the Sublime Text 2 menu, going into Preferences -> Package Settings -> SublimeLinter, and selecting Settings - User. Add this text to the file, save it, and restart Sublime Text 2:
{
"sublimelinter_executable_map":
{
"ruby": "rvm-auto-ruby"
}
}

Related

Atom autoclose-html how to force inline closing tags

Brand new to Atom. I see that I can force some html tags to close inline using the autoclose-html package. However, when I populate the list with tags to close inline, they are still closing on a separate line. How should the list be formatted? I see the defaults as
default: ['title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
And so I first tried adding ...'p', 'span'] to the list, and it did not work. I then found a list in autoclose-html.coffee and added the same, to no avail. What am I doing wrong?
The way I did this (Mac OS - should be same for other OS's):
Bring up Atom Settings (Atom menu --> Preferences)
Select Packages
Select autoclose-html Settings
Select View Code
Expand the lib folder
Select configuration.coffee
Make your changes in there and save the file.
Restart Atom
All done!
I don't know whether you have fix this issue. I just work it out.
It's nothing about this package, it's handled by atom's html-language plugin. Just open Atom->Snippets and add the following codes:
Sorry the preview looks terrible when I post the code as text. So I post a image here.

How to render action.js.coffee.erb?

I am getting a "missing template" error message when rendering an action with a js.coffee.erb extension. If I rename it to js.coffee or js.erb, I can get the controller to recognize the file, but I lose the pre-processor.
It looks like previous versions did not require the .erb to process ERB, but now it is required and the controller doesn't recognize the template.
Is anyone else seeing this?
It doesn't look like Rails is going to support rendering coffee script from an action:
https://github.com/rails/rails/issues/2391

Document upload (doc, docx, odt, etc.) and display in Rails (as text)?

Does anybody know how to upload a document to later show in a Rails application (as text)? Is Paperclip the right gem to do this? If it is how? (I have uploaded images before with Paperclip).
I like Paperclip. It seems well documented, and has worked well for everything I have needed. (I don't personally know any of them, but the clever folks at Thoughbot have created some pretty useful stuff, for which I feel indebted to them).
Obviously, you need to add Paperclip to your Gemfile, and (if you are using bundler) do your bundle install
Add to your model
has_attached_file :aFile
Add to you controller something to catch whatever you name it in your view (probably in your create and update methods)
#profile.aFile = params[:profile][:aFile]
Probably should check for its existence, if it is a required param
if params[:profile][:aFile].blank?
redirect_to #profile
else
render :action => 'do_something_interesting_with_file'
end
And that's about it. Don't forget your config entries. For example, if you are using some kind of post-processing on the file
Paperclip.options[:command_path] = "/opt/local/bin/"
I found this to be extraordinarily helpful
RailsCast by Ryan Bates

Rails3 UJS response not evaluated

It gives me the creeps,i'm done, i need some help here, i reverted multiple times back but i can't find the error.
Simple controller (customers),a simple form for adding a customer via :remote => true and the controller does respond_to do |format| { format.js } . Works fine, renders my create.js.rjs template.
I work for a few hours without making any javascript changes or changes to my controllers or authorization etc.. and when i try it again it's not working anymore.
What i mean with not working: Controller gets called, record saved, all partials rendered. But no javascript evaluated, not even a simple alert(1) at the beginning of the file.
I tried with different prototype.js versions and different rails.js versions, but nothing helped. I hope someone has a clue about this or already experienced this.
It's not that i don't want to post code. But it won't help. Its basic code that works and, after some changes where i don't know what i really changed (some locales here, some css there, html templates from a completely different controller a bit..)..
Currently developing with: ruby 1.9.2, rails 3.0.3, prototype 1.7 RC3, rails.js from github.
SOLVED
How stupid, I missed the part where the template naming changed. My application templace was named "application.rhtml". It worked until now. As it stopped to work, I changed it to "application.html.erb" and now it's working.

How do I write a Photoshop Extension (8BX) plugin?

The Adobe Photoshop CS3/4 SDK has a lot of examples for Filter, Import, Export, etc plugins but I haven't found anything that illustrates how to write a 8BX plugin.
The reason is, I need to write one is to add a new drop-down menu to the Photoshop root toolbar (where it displays File, Edit, Image ... Window. Help drop-down menus). I have seen a product like OneSoftware install an 8BX plugin into Adobe Photoshop CS3\Plug-Ins\Extensions directory that causes PS to add adrop down menu for OneSoft. That suggests this is a solvable problem :-)
I tried by changing an existing plugin in the SDK samples but no go. Specifically I modified the resource file:
resource 'PiPL' (ResourceID, plugInName " PiPL", purgeable)
{
{
Kind { **Extension** },
Name { plugInName "..." },
...
Despite using the Extension Kind, PS never loads the plugin. It doesn't generate any compile-time or load error either.
Does anyone have any ideas on how to go about doing this?