Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:23:50+00:00 2026-05-27T13:23:50+00:00

this is my method def add @result @log = Log.new(params[:log]) if @log.save result =

  • 0

this is my method

def add
    @result
    @log = Log.new(params[:log])
    if @log.save
      result = "success";
    else
      result = "fail";
    end
    render :json => result
end

and this is my routes.rb

match "/logs/add/:value/:category/:note/:own" => "logs#add"

when i try putting this URL:

http://localhost:3000/logs/add/338/testcat/testnote/testown

and it returns the json correctly and new item was added to the database but
all of the fields(value,category,note,own) are null.

please help 🙁


I’ve already solved the above problem, but

What if i want to create multiple objects by sending from 1 url to my ruby.
Ex:

localhost:3000/logs/add/338/testcat/testnote/testown

The above request will create only 1 log to my database
If I want to create many logs by using the above solution, I have to send one url for one log.
I want my ruby to be able to create multiple logs from 1 url.
I mean that I can create many logs by sending only one url to the server.
What routing,method,url should be?
(I heard something about “url/add/param1&&param2” ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:23:51+00:00Added an answer on May 27, 2026 at 1:23 pm

    You’re calling Log.new(params[:log]) but there isn’t a log parameter in the request.

    You can fix this by updating your #new call:

    @log = Log.new({
        :value => params[:value],
        :category => params[:category],
        :note => params[:note],
        :own => params[:own]
    })
    

    but bear in mind that you will then have a GET request which changes your database state. This is potentially a security flaw, because a potential attacker could get you to update your database just by following a link (from their website, in an email etc). This could even be a problem without a malicious attacker – Google will happily follow GET links – and even if you hide your site behind a login, it’s not impossible to think of a situation where Chrome may try and speed up your browsing session by “intelligently” preloading a link it spots in the page before you click it.

    Generally all of your data-changing actions should be limited to POST requests

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've got a Ruby method like this: def something(variable, &block) .... end And
from django.core.exceptions import FieldError #This is a method of a class def _order_item_list(self, item_list,
So, thinking I'm all clever, I add a method like this to Object :
How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
I have methods in all of my models that look like this: def formatted_start_date
It seems that often __init__ methods are similar to this: def __init__(self, ivar1, ivar2,
I have a bunch of python methods that follow this pattern: def delete_session(guid): conn
This method works as expected - it creates a JTree with a root node
With this method declaration (no overloads): void Method(double d) { // do something with
Take this method /** * @return List of group IDs the person belongs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.