I'm trying to test a multipartform upload to a controller, but I'm not able to figure out how.
I don't know which type of Fake request body I should create. Anybody had this problem before?
As far as I've searched, there is no clean way to do this in Java, however you can do it using scala.
see this answer
Related
I have some background questions, because the more I think about it, the more confused I get.
What I want to make is a very simple reviewsite where people can leave a review/comment with a rating (no signin function). The frontend will have to be in React and it will also need an average rating component.
So far I set up a rails API and in the model I included a title, description and rating. But I'm thinking that it might be better to make a separate model for the ratings?? I'm not sure when it's better to create a separate model.
My second questions is; How would I test a React component using Rspec? Would I need a gem for that?? I don't understand how that even works when the Rspec file is in the Rails API, and you want to test a component inside the React app...
Maybe someone could explain this or send me a good link where I can find this information?? Of course I tried google, but it just left me even more confused.
Actually you can't build a SPA application just by using React. React is not a framework it's a library so you have to include React into a framework like AngularJS. Then, you can't test React or AngularJS with Rspec because Rspec is not meant for UI testing. You should use something like Protractor. Also, I recommend you look at Grape API to build the service layer of your application. Finally you should add a separate model for ratings if you build the application on a RDBMS because there could number of ratings. Otherwise for something like mongodb you can embed the ratings into the post table.
So I'm working as a software apprentice and I have to re-build a website.
Basically what the website does is: post different things (events,news,etc.) and all these posts have like a preview and then when you click on it, it takes you to the post.
The way thay it works is: in the code it has a template for the design of every post. But if you want to make a new post, you need to do it from WordPress.
So know I'm looking the way to do that, I think that the first developer used json to "call" the data from the database in WordPress (I guess).
So I hope that someone can help me with a different or a easier option to do that.
Thanks
There are various gems that integrate with the wordpress api. And you could always write your own api wrapper.
https://github.com/jordandobson/wordpress
https://codex.wordpress.org/WordPress_APIs
https://github.com/zachfeldman/rubypress
Im trying to understand the best method for creating a basic Rails app that is only interfaced with via GET values in the url. Im attempting to understand how to go about starting to write logic for this as well as generally where i would want to start coding. Would this main interface code be considered a helper? or should i migrate the code to the model?
An example of how i'd like to use this app is something like the following.
http://www.railsapp.com/?order_number=123&print_label=true
With this example url i hope to grab the order_number get some information from it, determine if print_label is true/false and output something to the user.
Im not looking for someone to write it all for me, i'm simply needing some guidance on the best structure on writing a rails app that is only interfaced with via a URL as well as the easiest method for gather GET values.
Between the 3 comments on the first post i am going to looking into Restful routing and by that gather my params to interact with them.
What does it mean if my web designer says this," I built custom site with RoR and rails NodeJs angularJs ember backbone fullstack meteor"?
I wanted him to edit an HTML5 template and after some back and forth that was his response. What do those things mean?
Those are different programming/scripting languages that he has built websites/apps in... I find it interesting that after telling you about all the JavaScript he has played with he didn't quite say he had the HTML5 experience you are needing. If you can't understand him now you probably wont have any better luck if you hire him to edit the template. You need to find someone you can communicate with efficiently.
I have 2 ruby on rails projects, one that has a form and posts it to the another project. The another project should then convert it to a model, quotation, and save it.
Ive made a quotation resource and a controller with a create method. The form's action is other-project/quotations and method post. From what I understand this should call the create method in the quotation controller.
However I am getting this error:
The change you wanted was rejected.
Maybe you tried to change something you didn't have access to.
Anyone know what is causing this error? Is it heroku-caused or does it have something to do with my applications? I'm fairly new to rails/heroku so I'm unsure, any help would be appreciated.
Edit 1
After some research it seems I need the authenticity tokens to match. However since I have two apps, how is this achieved?
Ok so after checking heroku logs it does seem to be an issue with CSRF. When I commented out the protect from forgery line in both apps it worked fine and I was able to send data between them.
Will need to some research into whether this is sensible thing to do (guessing not). Thanks for the tips everyone.