I'm new to rails and I would like to know how to make a form that submits to a database. I have tried devise but it seems that it deals with logins/users and it's not working for my purpose. I don't want anyone to do it for me, I have to learn :).
Creating a form that saves to a database is probably on of the most basic tasks to do with rails and is even handled in the "Getting Started"-Chapter in the Rails-Guides:
http://guides.rubyonrails.org/getting_started.html
Just work on that and you'll get the idea. It looks like it's a lot to do on that page, but it explains also the principles and all that. It becomes really interesting for you in chapter 5 and 6.
Creating a form With Rails 3 is exactly like in Rails 2.
Related
I'm a pretty big RoR novice but I've had a lot of problems with finding out even where to begin.
I'm looking for any tutorials or examples of apps that lets a user fill out a simple form in ruby, takes that information, redirects to another page, and posts the information. The user would be able to share that unique link with others, which shows that information.
I've taken a look at various gems such as Formtastic and Simpleforms but the tutorials on Railscast are outdated and it's difficult to get working. I believe it's because I'm on Rails 3.
I'm pretty lost here and if anything can just prod me in the general direction of where to start / give me general strategy of how I should tackle this, it'd be greatly appreciated. This seems incredibly easy but I'm making it harder for myself than what it is.
I'm actually looking to take an intensive RoR course in a few weeks but I need to get this simple MVP app done (it'll include video by nimbb API) for a deadline... so while I should definitely be putting in the effort to learn rather than cheat and drift, your help this time around would really be great :)
To a large extent this functionally is baked into rails. The simplest way to do this is without any extra gems (besides the default ones):
In your terminal run:
rails g scaffold form name:string message:text
Then the user can go to example.com/forms/new and enter their info. Once they submit the form rails auto redirects them to the view page for that new data. The URL of that page which will be something like /forms/n where n is some integer is the link to share.
If your struggling with rails concepts I would look at the rails guides, especially: http://guides.rubyonrails.org/getting_started.html
Started learning Rails, so may this question is obsolete but yet I want to know what exactly it is in rails.
I am trying to create a login form for users, so after googling i came across devise(yet not sure what exactly it do, but i gave a try yet).
Link for the tutorial- http://www.slideshare.net/wleeper/devise-and-rails
I am stuck with page 4 of 22 at -
Add some flash notices into the base template
I dont know where i do need to add these line.(things are on localhost) and I would like to know that I really i am following the correct tutorial to create a login form in Rails?
Base template is application.html.erb by default.
First and foremost, I am brand new to Ruby on Rails and very rusty when it comes to programming. I have done some research but I am still trying to learn the basic inner workings of RoR. I have completed the Ruby on Rails Tutorial by MHartl.
What I am attempting to do to expand my knowledge of Ruby on Rails is to add a comment function to the Microposts. I have tried to simply add a comment column into the db and then work it into the already functioning microposts. I have also tried to generate a new model called commments using the following line:
rails generate model Comment content:string user_id:integer micropost_id:integer
I think I may have been on to something with that last one but I am hitting a road block when it comes to implementing it. Can someone please point me in the right direction?
You may want to look into Rails associations between models which allow you to associate one record to others. I would recommend looking over the following resources:
A Guide to Active Record Associations
Cardinality and associations
ActiveRecord::Associations::ClassMethods
Your close and I think that looking through the Rails Guide will get you up to speed on what types of relations you want to define. If you need more hints just ask.
I wanted to make a web site with the following basic features- (1)User registration for buyers and sellers. (2)profile pages (3)A buyer should be able to post work and should get profile links of the corresponding seller who has expertise in that work.
As time progresses i would want to add more features to the site.The freelancer sites where user can post jobs and get bids is the best example of the work.
(1)I want my code to be maintainable as i woud be adding features later on. (2)It should be quick to develop. (3)Resources should be available(not the entire thing, atleast in bits and pieces) for the above requirements and should not be tough to find for future enhancements. (4)Design should be decoupled from the buisness logic as i would outsource the design work.
I was thinking of Ruby on Rails for this work as i have experience in the MVC model and RoR looks cool.I am from the mobility domain so i don't know whether RoR will suit my work
Would RoR suit this purpose.If yes where can i find the resources to the above mentioned requirements.
Thanks
Ruby on Rails would be ideal for this type of website.
Check out some of these resources for info on how to use Ruby on Rails:
http://guides.rubyonrails.org/
http://railscasts.com/
http://www.railsforum.com/
I noticed you are already aware of TeachMeToCode, but there is a tag there for all the Rails 3 tutorials, with some blog tutorials and what looks like the beginning of a series on how to build a del.icio.us clone. Since they are in Rails 3, they would be well worth checking out:
http://teachmetocode.com/screencasts/tag/rails-3/
One of the best tutorials:
http://railsforzombies.org
It will let you have your own point of view quickly.
It depends on with which languages you have experience. Any good MVC framework will do the job just fine but if you like Ruby syntax RoR is definitely a good framework to develop this kind of application.
I'd like to know what people think what websites are good examples of AJAX with Ruby on Rails at the moment.
I'm learning both and would like to see some good interesting examples of what can be done.
THanks,
Joe
http://haystack.com/
http://rubyonrails.org/applications
These links will open a new horizon for you.
Perhaps grab a copy of http://www.redmine.org/ and look it over. Maybe not the bleeding edge of ajax but there is some good stuff in there all around for rails development. I learned a lot from it.
If you're just getting started and interested in unobtrusive AJAX with jQuery, I have a blog post you might be interested in. Basically it takes a simple scaffold generated site and adds unobtrusive deleting with jQuery step by step - if that sounds like something you'd be interested in feel free to check it out.
Twitter.com is an excellent example of what can be done with AJAX. I believe the site is coded in Ruby on Rails as well.