Documentation in form builder does not show

Just bought my copy of rubymine 1.1.  It is looking a lot better, keep up the good work.
Here is a snippet of code where rubymine is having trouble displaying proper documentation:

<% labeled_form_for @practice, :html => {:class => 'form'} do |f| %>
  <%= f.error_message_on :base %>
  <div >
    <div >
      <%= f.text_field ractice_name %>
      <%= f.text_field :contact_name %>
      <%= f.text_field :address1 %>
      <%= f.text_field :address2 %>
      <%= f.text_field :city %>
      <%= f.select(:state, us_state_names_and_codes) %>
      <%= f.text_field :zip %>
  </div>
  ....
  <div ></div>
<% end %>

labeled_form_for is a function in application_helper.rb which extends the Rails form builder.

If I point to any of the form builder methods: text_field, select etc., rubymine shows no documentation found.  I can look it up using Rails API fine, but rubymine failsto display it.

Bharat

6 comments
Comment actions Permalink

Hello Bharat,

Here is a snippet of code where rubymine is having trouble displaying proper documentation:


<% labeled_form_for @practice, :html => {:class => 'form'} do |f| %>
  <%= f.error_message_on :base %>
  <div >
    <div >
      <%= f.text_field :practice_name %>
      <%= f.text_field :contact_name %>
      <%= f.text_field :address1 %>
      <%= f.text_field :address2 %>
      <%= f.text_field :city %>
      <%= f.select(:state, us_state_names_and_codes) %>
      <%= f.text_field :zip %>
  </div>
  ....
  <div ></div>
<% end %>


labeled_form_for is a function in application_helper.rb which extends the Rails form builder.


If I point to any of the form builder methods: text_field, select etc., rubymine shows no documentation found.  I can look it up using Rails API fine, but rubymine failsto display it.

Please try "Go to declaration" action on labeled_form_for call. What declaration does it navigates to?

Regards,
Oleg

0
Comment actions Permalink

Hello Oleg,
Perhaps I should have given you the entire path to labeled_form_for code:

When I do Go To Declartion on labeled_form_for, it correctly shows:

  def labeled_form_for(*args, &block)
    options = args.extract_options!.merge(:builder => LabeledFormBuilder)
    form_for(*(args + [options]), &block)
  end

which is in application_helper.rb file.  As you can see above, it uses my custom form builder called LabeledFormBuilder.  Here is a snippet of it:

class LabeledFormBuilder < ActionView::Helpers::FormBuilder
  %w[text_field collection_select select date_select password_field text_area file_field].each do |method_name|
    define_method(method_name) do |field_name, *args|
      @template.content_tag(:p, field_label(field_name, *args) + "<br />"  + super)
    end
  end
  ...
end

LabeledFormBuilder class is stored in labeled_form_builder.rb file which is stored in app/form_builders directory which is appended to Rails class_path in environment.rb (in config directory) as follows:

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.

  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )
  config.load_paths += %W( #{RAILS_ROOT}/app/form_builders )
   ...

This is how Ryan Bates recommends it in his Forms screencast.  It works fine.  I think Rubymine may not be able to infer the form builder in a custom directory?

Bharat

0
Comment actions Permalink

Hello Oleg/Roman,
One of the reasons that I decided to switch from NetBeans to Rubymine is its consistency in displaying documentation.  Netbeans is very erratic in that.  This is one of the few places where Rubymine fails.  Do you folks have any plans to fix this?
Bharat

0
Comment actions Permalink

Hello Bharat,

One of the reasons that I decided to switch from NetBeans to Rubymine is its consistency in displaying documentation.  Netbeans is very erratic in that.  This is one of the few places where Rubymine fails.  Do you folks have any plans to fix this?

We have plans on improving documentation support in future versions such as: hyperlinks, support for external documentation etc.
http://www.jetbrains.net/jira/browse/RUBY-3309
http://www.jetbrains.net/jira/browse/RUBY-3288
Feel free to comment and vote.

Are there any things in documentation support you miss comparing with Netbeans?

Regards,
Oleg

0
Comment actions Permalink

Hello,

Perhaps I should have given you the entire path to labeled_form_for code:


When I do Go To Declartion on labeled_form_for, it correctly shows:


  def labeled_form_for(*args, &block)
    options = args.extract_options!.merge(:builder => LabeledFormBuilder)
    form_for(*(args + [options]), &block)
  end


which is in application_helper.rb file.  As you can see above, it uses my custom form builder called LabeledFormBuilder.  Here is a snippet of it:


class LabeledFormBuilder < ActionView::Helpers::FormBuilder
  %w[text_field collection_select select date_select password_field text_area file_field].each do |method_name|
    define_method(method_name) do |field_name, *args|
      @template.content_tag(:p, field_label(field_name, *args) + "<br />"  + super)
    end
  end
  ...
end


LabeledFormBuilder class is stored in labeled_form_builder.rb file which is stored in app/form_builders directory which is appended to Rails class_path in environment.rb (in config directory) as follows:


Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.


  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )
  config.load_paths += %W( #{RAILS_ROOT}/app/form_builders )
   ...


This is how Ryan Bates recommends it in his Forms screencast.  It works fine.  I think Rubymine may not be able to infer the form builder in a custom directory?

What exactly message do you get when trying to get quick documentation?

0
Comment actions Permalink

Oleg,
This is all very good.  Hyperlinks and external documentation will make it even better.  As I said above, one of the reasons that I am moving to Rubymine from NetBeans is the documenation.  Thus far, this is the only place where Rubymine has failed in my testing.  I would like to see it successfully display the documentation in a deeply nested form element like this.  This is a fairly common pattern in creating your own form builders and I think that you guys are smart enough to be able to do that.  Rubymine 1.1.1 promise?
Regards,
Bharat

0

Please sign in to leave a comment.