form not loading for get request

16 views
Skip to first unread message

fugee ohu

unread,
Nov 30, 2019, 6:27:50 PM11/30/19
to Ruby on Rails: Talk
This request has some utf8 in between "item_type_id" and "="
GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=9&commit=New+item HTTP/1.1

Ariel Juodziukynas

unread,
Nov 30, 2019, 8:07:43 PM11/30/19
to rubyonra...@googlegroups.com
It's normal that rails adds a hidden field with the name `utf8` and a check as the value, when you submit a form using GET the hidden field goes there with the other fields, there's nothing wrong there.

You should have some error on the console if something is not working, that `utf8` parameter is ok.

El sáb., 30 nov. 2019 a las 20:28, fugee ohu (<fuge...@gmail.com>) escribió:
This request has some utf8 in between "item_type_id" and "="
GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=9&commit=New+item HTTP/1.1

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4e4ee2a6-e656-4dd2-84f0-670f9eaa40b0%40googlegroups.com.

fugee ohu

unread,
Nov 30, 2019, 8:26:30 PM11/30/19
to Ruby on Rails: Talk


On Saturday, November 30, 2019 at 8:07:43 PM UTC-5, Ariel Juodziukynas wrote:
It's normal that rails adds a hidden field with the name `utf8` and a check as the value, when you submit a form using GET the hidden field goes there with the other fields, there's nothing wrong there.

You should have some error on the console if something is not working, that `utf8` parameter is ok.

El sáb., 30 nov. 2019 a las 20:28, fugee ohu (<fuge...@gmail.com>) escribió:
This request has some utf8 in between "item_type_id" and "="
GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=9&commit=New+item HTTP/1.1

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.

That's the last thing in the console Here's my form:

<%= form_with(model: @item, url: new_item_path(@item), method: "get") do |f| %>

     <div class="field">
         <%= f.select :item_type_id, nested_set_options(ItemType.all, @item_type) {|i| "#{'-' * i.level} #{i.name}" }, {:include_blank => "Select"}%>
     </div>

    <div class="actions">
        <%= f.submit "New item" %>
    </div>

<% end %>

fugee ohu

unread,
Nov 30, 2019, 8:37:05 PM11/30/19
to Ruby on Rails: Talk
 I guess I'd better explain the form I just posted is from the index view and on submit it's supposed to launch the new action and load the next form

Ariel Juodziukynas

unread,
Nov 30, 2019, 9:01:50 PM11/30/19
to rubyonra...@googlegroups.com
The form looks ok, the parameters on the request too, it's impossible to tell you something else if you have nothing on the logs (rails and the browser's network tab) that could indicate an error

El sáb., 30 nov. 2019 a las 22:37, fugee ohu (<fuge...@gmail.com>) escribió:
 I guess I'd better explain the form I just posted is from the index view and on submit it's supposed to launch the new action and load the next form

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
Message has been deleted

fugee ohu

unread,
Dec 1, 2019, 8:30:07 AM12/1/19
to Ruby on Rails: Talk


On Saturday, November 30, 2019 at 9:01:50 PM UTC-5, Ariel Juodziukynas wrote:
The form looks ok, the parameters on the request too, it's impossible to tell you something else if you have nothing on the logs (rails and the browser's network tab) that could indicate an error

El sáb., 30 nov. 2019 a las 22:37, fugee ohu (<fuge...@gmail.com>) escribió:
 I guess I'd better explain the form I just posted is from the index view and on submit it's supposed to launch the new action and load the next form

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.

It gets a 500 response
127.0.0.1 - - [01/Dec/2019:08:25:49 EST] "GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item HTTP/1.1" 500 0
http://localhost:3000/items -> /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item
How do I find the error?

Ariel Juodziukynas

unread,
Dec 1, 2019, 9:13:53 AM12/1/19
to rubyonra...@googlegroups.com
What's your log level value? make sure it's "debug" on your environment https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels

To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/77108a16-3395-4562-aabd-dbd77d8f80ee%40googlegroups.com.

fugee ohu

unread,
Dec 1, 2019, 9:59:33 AM12/1/19
to Ruby on Rails: Talk


On Sunday, December 1, 2019 at 9:13:53 AM UTC-5, Ariel Juodziukynas wrote:
What's your log level value? make sure it's "debug" on your environment https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels

El dom., 1 dic. 2019 a las 10:30, fugee ohu (<fuge...@gmail.com>) escribió:


On Saturday, November 30, 2019 at 9:01:50 PM UTC-5, Ariel Juodziukynas wrote:
The form looks ok, the parameters on the request too, it's impossible to tell you something else if you have nothing on the logs (rails and the browser's network tab) that could indicate an error

El sáb., 30 nov. 2019 a las 22:37, fugee ohu (<fuge...@gmail.com>) escribió:
 I guess I'd better explain the form I just posted is from the index view and on submit it's supposed to launch the new action and load the next form

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a4caf763-b02f-4d25-980d-a55310a55fa1%40googlegroups.com.

It gets a 500 response
127.0.0.1 - - [01/Dec/2019:08:25:49 EST] "GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item HTTP/1.1" 500 0
http://localhost:3000/items -> /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item
How do I find the error?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.

Now I get 200 response and the log says it rendered items/_form.html.erb but the order of operations looks backwards First it renders the form then there's the get request to the new action Shouldn't the get request to the new action come first?

Started GET "/items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item" for 127.0.0.1 at 2019-12-01 09:56:33 -0500
Processing by ItemsController#new as JS
  Parameters: {"utf8"=>"✓", "item"=>{"item_type_id"=>"1"}, "commit"=>"New item"}
  ItemProperty Load (0.7ms)  SELECT `item_properties`.* FROM `item_properties` WHERE (item_type_id='1')
  Rendering items/new.html.erb within layouts/application
  ItemType Load (0.7ms)  SELECT  `item_types`.* FROM `item_types` WHERE `item_types`.`id` = 1 LIMIT 1
  Rendered items/_form.html.erb (9.2ms)
  Rendered items/new.html.erb within layouts/application (13.9ms)
Completed 200 OK in 48ms (Views: 39.8ms | ActiveRecord: 1.4ms)


127.0.0.1 - - [01/Dec/2019:09:56:33 EST] "GET /items/new?utf8=%E2%9C%93&item%5Bitem_type_id%5D=1&commit=New+item HTTP/1.1" 200 1749
Reply all
Reply to author
Forward
0 new messages